Workaround:
We need to explicitly add a new class file with the name
Global.cs and inherit it with System.Web.HttpApplication [As the Global.asax
codebehind file in 1.x].Now copy the whole content inside the <script> tag
inside the class. So the resultant class looks like,
/// <summary>
/// Summary description for Global
/// </summary>
public class Global : System.Web.HttpApplication
{
public static readonly string AdminRole =
ConfigurationManager.AppSettings["ADM"];
public static readonly string AnonymousRole =
ConfigurationManager.AppSettings["ANM"];
public Global()
{
//
// TODO: Add constructor logic here
//
}
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
}
void Application_End(object sender, EventArgs e)
{
// Code that runs on application shutdown
}
void Application_Error(object sender, EventArgs e)
{
// Code that runs when an unhandled error
occurs
}
void Session_Start(object sender, EventArgs e)
{
// Code that runs when a new session is started
}
void Session_End(object sender, EventArgs e)
{
// Code that runs when a session ends.
// Note: The Session_End event is raised only when
the sessionstate mode
// is set to InProc in the Web.config file. If
session mode is set to StateServer
// or SQLServer, the event is not raised.
}
}
And then we need add the inherits attribute to @Application
directive in Global.asax file to point to the added class.So the resultant
Global.asax file will contain,
<%@ Application Language="C#" Inherits="Global"%>
|