putting C# classes in App_Code

putting C# classes in App_Code

am 24.07.2007 22:54:02 von accessing C# classes in App_Code

I've a simple aspx page whose code behind instantiates a simple class which
exists in a .cs file in the App_Code folder of my project. Runs fine in the
IDE. When I copy the app to my IIS server I get this error in my browser:

Compilation Error
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.

Compiler Error Message: CS0246: The type or namespace name 'CustomClass'
could not be found (are you missing a using directive or an assembly
reference?)

Source Error:
Line 18: protected void Button1_Click(object sender, EventArgs e)
Line 19: {
Line 20: CustomClass c = new CustomClass();
Line 21: Label1.Text = c.GetMessage(TextBox1.Text);
Line 22: }

Source File: c:\Inetpub\wwwroot\AppCode_test\Default.aspx.cs Line: 20

What's up?

Re: putting C# classes in App_Code

am 24.07.2007 23:06:54 von reb01501

accessing C# classes in App_Code wrote:
> I've a simple aspx page whose code behind instantiates a simple class
> which exists in a .cs file in the App_Code folder of my project. Runs
> fine in the IDE. When I copy the app to my IIS server I get this
> error in my browser:

There was no way for you to know it (except maybe by browsing through some
of the previous questions in this newsgroup before posting yours - always a
recommended practice) , but this is a classic asp newsgroup. ASP.Net bears
very little resemblance to classic ASP so, while you may be lucky enough to
find a dotnet-knowledgeable person here who can answer your question, you
can eliminate the luck factor by posting your question to a group where
those dotnet-knowledgeable people hang out. I suggest
microsoft.public.dotnet.framework.aspnet.
There are also forums at www.asp.net
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Re: putting C# classes in App_Code

am 24.07.2007 23:36:01 von LRuss

Thanks for pointing this out Bob. I found the solution to my problem; the
App_Code folder must sit in the site root, not in the virtual directory.

Len

"Bob Barrows [MVP]" wrote:

> accessing C# classes in App_Code wrote:
> > I've a simple aspx page whose code behind instantiates a simple class
> > which exists in a .cs file in the App_Code folder of my project. Runs
> > fine in the IDE. When I copy the app to my IIS server I get this
> > error in my browser:
>
> There was no way for you to know it (except maybe by browsing through some
> of the previous questions in this newsgroup before posting yours - always a
> recommended practice) , but this is a classic asp newsgroup. ASP.Net bears
> very little resemblance to classic ASP so, while you may be lucky enough to
> find a dotnet-knowledgeable person here who can answer your question, you
> can eliminate the luck factor by posting your question to a group where
> those dotnet-knowledgeable people hang out. I suggest
> microsoft.public.dotnet.framework.aspnet.
> There are also forums at www.asp.net
> --
> Microsoft MVP - ASP/ASP.NET
> Please reply to the newsgroup. This email account is my spam trap so I
> don't check it very often. If you must reply off-line, then remove the
> "NO SPAM"
>
>
>

Re: putting C# classes in App_Code

am 24.07.2007 23:38:01 von LRuss

BTW Bob, do you know where the ASP.NET newsgroup is on MSN?

"Bob Barrows [MVP]" wrote:

> accessing C# classes in App_Code wrote:
> > I've a simple aspx page whose code behind instantiates a simple class
> > which exists in a .cs file in the App_Code folder of my project. Runs
> > fine in the IDE. When I copy the app to my IIS server I get this
> > error in my browser:
>
> There was no way for you to know it (except maybe by browsing through some
> of the previous questions in this newsgroup before posting yours - always a
> recommended practice) , but this is a classic asp newsgroup. ASP.Net bears
> very little resemblance to classic ASP so, while you may be lucky enough to
> find a dotnet-knowledgeable person here who can answer your question, you
> can eliminate the luck factor by posting your question to a group where
> those dotnet-knowledgeable people hang out. I suggest
> microsoft.public.dotnet.framework.aspnet.
> There are also forums at www.asp.net
> --
> Microsoft MVP - ASP/ASP.NET
> Please reply to the newsgroup. This email account is my spam trap so I
> don't check it very often. If you must reply off-line, then remove the
> "NO SPAM"
>
>
>

Re: putting C# classes in App_Code

am 25.07.2007 15:22:07 von Jon Paal

look here:

microsoft.public.dotnet.framework.aspnet