Thursday, October 29, 2009

Site Under Maintenance with ASP.Net 2.0

If you have worked with deploying websites onto production/test environments, you might have wanted to show a 'Site Under Maintenance' or a similar message to all those who tries to access the website. To achieve this, people used to resort to all kinds of  setups ranging from HttpModules to setting up a html page as default page of the application.

Now in Asp.Net 2.0 onwards we have a simple way of acheiving this. Just put a file NAMED app_offline.htm in the root folder of the application and : voilĂ !! all new requests will be redirected to that html page. 

To revert back, just rename the file to some other name. Neat & clean. 


[Edit 04 Aug 2010 ] This might not be good idea as ASP.Net responds with a 404 http code. Ideally it should have been 200.

No comments: