By default, when you create an ASP.NET Web Application, a Global.asax file will automatically be added to the project for you.
Unfortunately, however, this file will usually only contain a single event handler--namely Application_Start.
If you want to see the other Global.asax Event Handlers, unfortunately, you are out of luck in terms of being able to add them easily to the file since there is no built-in Intellisense to add these additional event handlers.
However if you add a brand NEW Global.asax file to an Empty ASP.NET Web Application, you will get the following default event handlers:
The resultant Global.asax file looks like the following:
In addition, this article provides an excellent overview of all of the other Global.asax Event Handlers that are available: http://www.techrepublic.com/article/working-with-the-aspnet-globalasax-file/
This article also has an overview of Global.asax events: http://www.dotnetcurry.com/ShowArticle.aspx?ID=126
However, one of the events I found did not exist in either of these lists was
Application_PostAuthenticateRequest
This event is particularly used when dealing with ASP.NET Forms Authentication and Claims Augmentation.
The most comprehensive list of Global.asax Events can be found in this MSDN article: https://msdn.microsoft.com/en-us/library/system.web.httpapplication.authenticaterequest%28v=vs.110%29.aspx
Unfortunately, however, this file will usually only contain a single event handler--namely Application_Start.
If you want to see the other Global.asax Event Handlers, unfortunately, you are out of luck in terms of being able to add them easily to the file since there is no built-in Intellisense to add these additional event handlers.
However if you add a brand NEW Global.asax file to an Empty ASP.NET Web Application, you will get the following default event handlers:
- Application_Start
- Session_Start
- Application_BeginRequest
- Application_AuthenticateRequest
- Application_Error
- Session_End
- Application_End
The resultant Global.asax file looks like the following:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
namespace WebApplication1
{
public class Global : System.Web.HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
}
protected void Session_Start(object sender, EventArgs e)
{
}
protected void Application_BeginRequest(object sender, EventArgs e)
{
}
protected void Application_AuthenticateRequest(object sender, EventArgs e)
{
}
protected void Application_Error(object sender, EventArgs e)
{
}
protected void Session_End(object sender, EventArgs e)
{
}
protected void Application_End(object sender, EventArgs e)
{
}
}
}
In addition, this article provides an excellent overview of all of the other Global.asax Event Handlers that are available: http://www.techrepublic.com/article/working-with-the-aspnet-globalasax-file/
This article also has an overview of Global.asax events: http://www.dotnetcurry.com/ShowArticle.aspx?ID=126
However, one of the events I found did not exist in either of these lists was
Application_PostAuthenticateRequest
This event is particularly used when dealing with ASP.NET Forms Authentication and Claims Augmentation.
The most comprehensive list of Global.asax Events can be found in this MSDN article: https://msdn.microsoft.com/en-us/library/system.web.httpapplication.authenticaterequest%28v=vs.110%29.aspx
No comments:
Post a Comment