Global events in ASP.NET

0 comments
The following are the global events handled in the global.asax.vb file.

Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
End Sub

This event is fired when the application is started. The application starts when the first request comes to the web server after the IIS is started.

The Application start event can occur if the IIS is restarted, server rebooted, web.config file is changed or if the ASP.NET process recycles.

ASP.NET process recycles for various reasons like insufficient memory, server overload, other un expected errors etc.

This is the first event fired in ASP.NET after the application starts.


Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
End Sub


Session_Start event is fired each time a new session is started.


Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
End Sub


Application_BeginRequestis fired each time a new page is requested in the website. This event is fired after the Session_Start event.


Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs)
End Sub


Application_AuthenticateRequest is fired upon attempting to authenticate the user and after the Application_BeginRequest event.


Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
End Sub


If there is any unexpected error or un handled exception in the application, this event is fired. You can use this event to keep track of un expected errors in your web site and also to report such errors to the web master.

You will learn more about this event in the next chapter.


Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
End Sub


READ MORE >>
http://dotnetspider.com/tutorials/AspNet-Tutorial-28.aspx

0 comments: