Click here to Skip to main content
15,900,973 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have created a simple ASP.NET Website in Visual Studio 2010. I have a static C# class (lets call it someClass) contained in a separate file in the App_Code folder. I call a method from that class in my page's code behind like so:
C#
someVar = someClass.someMethod(someParam);

This compiles correctly in VS 2008 but when I move it over to my IIS server, I get the following error
(CS0103): 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: CS0103: The name 'someClass' does not exist in the current context
I have created a virtual directory for this website enabling 'Read', 'Run scripts (such ASP)', and 'Execute (such as ISAPI applications or CGI)'. I am not currently utilizing namespaces (as I thought I would not need to and I'm not sure how to use them properly). What am I doing wrong?
Posted
Updated 9-Jan-12 20:38pm
v2
Comments
Sergey Alexandrovich Kryukov 10-Jan-12 3:09am    
Not enough information. OK, ask yourself, where is that class?
--SA

You may need using directives (and probably first add reference to the project where your "someClass" is)
 
Share this answer
 
Even in the case the namespace of the asp Page is the same as your helper classes, you need to import the namespace explicitly using the <@ Import namespace="..." %> directive
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900