My hosted website is not working, and is giving an error.
**The name 'General' does not exist in the current context**
Line 19: if (passedArgument == "true")
Line 20: {
Line 21: General.Session.UserID = "";
Line 22: General.Session.UserName = "";
Line 23: General.Session.ShoppingCart = null
General is, as you can see, a namespace containing the class Session.
namespace General
{
/// <summary>
/// Summary description for Session
/// </summary>
public class Session
{
public Session()
{
}
My service provider tells me I should check my code, but it’s working just fine on my local machine. Why is it not finding the namespace, and generating the error?
Usually, this means that you are running in a sub-directory (i.e. not the site-root), and that directory is not marked as an application in IIS.
Basically, App_Code is resolved relative to the nearest application (or the root otherwise). So if your app is at
/someapp, then instead of looking in/someapp/App_Code, it is looking in/App_Code. Where your files aren’t.If this is the case, mark the folder as an application in IIS. This varies between IIS versions, but the end-result is that the folder icon should display a cog in IIS.