Events in Global.asax are not firing

余生颓废 提交于 2019-12-01 17:48:29

问题


In my ASP.Net application, I can't get the events in Global.asax to fire on my machine. For instance, Session_Start will not fire.

The same Global.asax works fine on other development machines in my office.

I have tried:

  • Both the ASP.Net Development Server and my local IIS

  • Rebooting the machine

  • Removing and recreating the file from the project (including deleting it
    from disk)

  • All machines are configured the with the same level of software (VS2008
    SP1, .Net 3.5, XP)

This is driving me crazy, any help out there?

EDIT: Since the application works on other machines, I don't think it is directly related to the contents of Global.asax. For some reason, my machine does not process the files. I have done a repair of VS 2008 and .Net 2.0. Any other ideas?

EDIT: The application running on all three machines is being pulled directly from source control. It is definitely something specific to the one machine.

Thanks,

Pat


回答1:


Application level events only need proper naming to work. Is your codebehind class being designated in your Global.asax file?

<%@ Application Inherits="YourNamespace.YourApplicationClass" Language="C#" %>



回答2:


This is a long shot but I have been bitten by this before. When you created your Global.asax.cs file did you make sure to include a basic Global.asax file in your project?

Also make sure that the inherits property in that Global.asax is pointing to your custom class (namespace and all) in your Global.asax.cs file.

I had this problem once and it was because I totally forgot to make the Global.asax file and hook it up to my class. I had just copied the Global.asax.cs from another project that did something similar.




回答3:


becuase project is compiled first and then you have add or modify or changed location of global.asax.vb.

Solution :- Just remove debug folder. Clean project and then rebuild whole project.

Regards, Mihir




回答4:


As I write here, in my case, I was publish my site in production and I miss copy to server App_global.asax.compiled file. For this reason was not fire the Events inside Global.asax.

Hope anyelse help this tips, I lost 8 hours seeking.




回答5:


If you have fiddled with ASP.NET then maybe try reinstalling it.



来源:https://stackoverflow.com/questions/648713/events-in-global-asax-are-not-firing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!