Sometimes it is really a big pain to take your application offline. ASP.net has one very good feature to take your application offline without any pain.
Method : put an HTML file named app_offline.htm in the root directory of your web site. ASP.net will shutdown your application, Will unload your application domain, and for every request made to your web site it will return the content of App_Offline.htm
So now you don’t need to write any logic for taking your application offline.
1. Make sure you put at least 512 bytes content in the page, otherwise the browser will display 404 Not Found.
There is one more way to take your application offline : You can set enabled attribute to false in <httpRuntime> tag.