Sunday, June 19, 2011

Put your ASP.NET 2.0 application Offline - the user friendly way!



Every web application has its Life Cycle. This cycle involves (among many other things) developing, deploying, debugging, maintenance etc.

When your web application is already deployed on production server, making some critical changes on it can be a challenging
task if you have multiple visitors online.

Developers at Microsoft added one nice feature to ASP.NET 2.0 that addresses this very problem:

if you upload a html file named "app_offline.htm"  to the root of your website, ASP.NET recognizes this file, shuts down your application, and for every next requested page, contents of  your "app_offline.htm" file is server instead.

When you are done updating your website, you can delete this file or just rename it, and your website will start working again

NOTE:
One thing to be careful about: It is recommended that your "app_offline.htm" file size is minimum 512 bytes in order to be shown correctly in Internet Explorer 6.
(This is because IE6 has setting called "Show Friendly Http Errors" that shows its own error messages instead of the pages returned from web server - if they have HTTP status code different than 200 and if they are smaller than 512 bytes in size).

No comments :

Post a Comment