putting C# classes in App_Code

  • Thread starter accessing C# classes in App_Code
  • Start date
A

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?
 
B

Bob Barrows [MVP]

accessing said:
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
 
L

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,039
Messages
2,570,376
Members
47,029
Latest member
EmiliaSton

Latest Threads

Top