C# – Global.asax issue

chttpapplicationhttpmodulenetvisual-studio-2008

I am developing an HttpModule and using Global.asax. I have developed a class which derives from HttpApplication, but Application_Start method of my class never executes (I create a file at the beginning of Application_Start but the file never creates, and it is why I think Application_Start never executes). I am using VSTS2008 + C# + .Net 3.5.

Any ideas what is wrong and how to debug? I want to confirm I should copy the Global.asax into the root directory of my web site virtual directory, correct? Should I configure anything in web.config to let the HttpModule run?

Best Answer

Application_Start executes only once when an application starts first time. Do you have restarted your application?

Yes, Global.asax must be in the root directory.

You must add your new ASP.NET module into web.config <httpModules> section.