The purpose of the code associated with the Global.asax is to hold functionality to respond to various application-level events.
But why is there a markup file associated with the Global.asa开发者_如何学运维x.cs? I presume this is an ASP.NET implementation side effect?
After some search I found this sentence from MSDN
When you save changes to an active Global.asax file, the ASP.NET page framework detects that the file has been changed. It completes all current requests for the application, sends the Application_OnEnd event to any listeners, and restarts the application domain. In effect, this reboots the application, closing all browser sessions and flushing all state information. When the next incoming request from a browser arrives, the ASP.NET page framework reparses and recompiles the Global.asax file and raises the Application_OnStart event.
It seems a reason to have a markup file.
精彩评论