Based on a configuration setting I’d like to direct users to a “This site is currently offline” page. The master page seems like the common place to do that. I originally used this code:
MyConfig config = new MyConfig();
protected void Page_PreInit(object sender, EventArgs e)
{
if (config.RefuseRequests)
Response.Redirect("Offline.aspx");
}
A break point here is never hit.
After some digging I came across http://msdn.microsoft.com/en-us/library/dct97kc3.aspx which seems to say a master Page_PreInit is never called. Am I reading that right?
The above code doesn’t show an error in visual studio and it seems like a useful step in the load flow. Are there any conditions where a master page Page_PreInit would be executed?
While the information out there isn’t as clearly stated as I’d like the practical answer does appear to be “no, a master
Page_PreInit()will never be hit.”