Set Masterpage from Global.asax in ASP.NET
- by StefanE
Hi,
I want to set the Masterpage property in Global.asax.
This is what I have done but I get a NullReferenceException on the first line. Any ideas how to do this?
protected void Application_PreSendRequestContent(Object sender, EventArgs e)
{
System.Web.UI.Page page = System.Web.HttpContext.Current.Handler as System.Web.UI.Page;
if (Session["lang"] == "eng")
{
page.MasterPageFile = "SideMasterPageEng.master";
}
}