473,385 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

putting 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?
Jul 24 '07 #1
4 6865
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"
Jul 24 '07 #2
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"
Jul 24 '07 #3
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"
Jul 24 '07 #4
look here:

microsoft.public.dotnet.framework.aspnet
Jul 25 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Steve Franks | last post by:
I'm using VS.NET 2005 Beta 2. I have a helper C# class I wrote that I placed in my /App_Code directory. Everything runs fine locally. However when I use the "Copy Web" function to upload the site...
10
by: ptass | last post by:
Hi In asp.net 2.0 an aspx files .cs file is a partial class and all works fine, however, I thought I’d be able to create another class file, call it a partial class and have that compile and...
2
by: pradeep_TP | last post by:
Hello, I am trying to use APP_CODE folder for all my class files under VS 2005. After adding APP_CODE in the solution explorer, I added a new web page by right clicking project and selecting add...
1
by: shapper | last post by:
Hello, I have 4 classes, under the same namespace, which I created while developing a web site. I have this four classes under app_code folder of my web site. I would like to compile this...
2
by: Random | last post by:
Here's a design question I'm curious to know if anyone here has wrestled with before... I'm writing my data access methods in classes in the App_Code directory. I know that I can easily...
1
by: hockeydave007 | last post by:
Hi, I have a similar problem to this thread (http://www.thescripts.com/forum/thread507360.html). I have a class App_Code/SiteContent.cs that works just fine in Visual Studio, but does not...
5
by: Randy | last post by:
I've converted a VS 2003 project to VS 2005. I have one utility class that it put in the APP_CODE directory. When I try and compile I'm getting this error... Error 1 The type or namespace name...
1
by: realfantasy | last post by:
hi guys i have a problem regarding asp.net/vb.net, normally we make utility classes or any custom classes and put them in app_code folder but i need to put those class files outside of app_code...
2
by: jehugaleahsa | last post by:
Hello: We recently moved from Visual Studio 2005 to 2008. Today I published an older web application using 2008. I had to migrate this project. When I run this project from my local machine,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.