title: How to change a website default document programmatically on the fly
body: <p>Using ASP.NET 4.0, IIS 7.5.</p>
  
  <p>I have a website engine, I have just implemented a way for this to tell if it's being loaded on mobile and instead of loading <code>Controls\MyControl.ascx</code> it loads <code>Mobile\Controls\MyControl.ascx</code>. This works well for my controls and also my <code>MasterPage.Master</code> file.</p>
  
  <p>What I can't figure out however is how I can do the same with Default.aspx. This needs to be done on the fly programatically as I need to be able to check if it's mobile version. I was thinking of doing something on a pre-init event in globals but not sure if that's the best way.</p>
  
  <p>Note: I don't want to use inline code on Default.aspx and just display different content base on my <code>Mobile</code> flag as my scenario goes one step further by basing the file on customer as well and this would mean having one huge Default.aspx for all customers which wouldn't be manageable.</p>