Hello-
I inherited an asp.NET application written in C#. It is not a project and not associated with a solution; it is simply a collection of aspx files and their associated aspx.cs files.
It's a programming mess, and I'm trying to rewrite it using class objects. They work fine, but I have to put the classes in each code-behind page; this is clearly not right.
Newbie question, sorry, but how can I place my classes in a single myClasses.cs file and let my other aspx.cs code-behind files use them? I've looked at a hundred different posts on this, but I can't seem to get at this one very simple question.
I've tried a lot of things, and sometimes Intellisense sees my classes while coding, but then my application errors out when I try to run it.
Any help is appreciated.
What I have tried:
My class:
<pre>public class BasePage : System.Web.UI.Page
{
public int YourMethod(string str)
{
int someNum = 1;
return someNum;
}
}
And then to access it from another page:
<pre>public class Default : BasePage
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
I've also tried a bunch of variations on this.