Friday, May 29, 2009

how to check if Global.asax is functioning

After deployment many times Global.asax stops working.The below code can be used to check if it is working or not. More details can be found at

http://bytes.com/groups/net-asp/501901-web-deployment-projects-global-asax-problem

==========
protected void Page_Load(object sender, EventArgs e)
{
        Response.Write("ApplicationInstance: " + Context.ApplicationInstance.GetType().FullName);
}
==========

It will output something like: "ApplicationInstance: ASP.global_asax" if the global.asax is loaded,

OR "ApplicationInstance: System.Web.HttpApplication" if the global.asax is NOT loaded.