This answer is community wiki so as not to generate any reputation, as it's effectively a reworking of DOK's answer. If you like it, please upvote DOK's answer.
@Dok, if you want to edit your answer to incorporate any of this, please do, and I'll gladly delete this answer. :)
DOK, as mentioned in my comments to your answer (and possibly some help for your own solution), you might want to do the following:
#if DEBUG //As mentioned by DOK in the comments. If you set debug to false when building for deployment, the code in here will not be compiled.
protected void Page_PreInit(object sender, EventArgs e)
{
bool inDevMode = false;
inDevMode = bool.Parse(ConfigurationManager.AppSettings["InDevMode"]); //Or you could use TryParse
if(inDevMode)
{
// Fake authentication so I don't have to create a damn Login page just for this.
System.Web.Security.FormsIdentity id = new FormsIdentity(new FormsAuthenticationTicket("dok", false, 30));
string[] roles = { "a" };
HttpContext.Current.User = new System.Security.Principal.GenericPrincipal(id, roles);
}
}
#endif
To further ensure that you do not accidentally deploy with this active, then you would have your app settings in seperate config files (as well as your debug section). If you use Web Deployment projects, then you can put your dev config settings in one file, and your live config files in another (this is usually dev.config and live.config!).
eg, in your web.config:
<appSettings file="dev.config"/>
In your dev.config:
<appSettings>
<add key="InDevMode" value="true" />
</appSettings>
In your live.config:
<appSettings>
<add key="InDevMode" value="false" />
</appSettings>