App_Offline.htm in ASP.NET

One of the most useful features of ASP.NET is the “App_Offline.htm” . It provides a much easy way to make the ASP.NET application offline while we do our modifications on the site.

How we do it?

We just create a file and name it exactly  as ‘app_offline’ and place it in the root of a web application directory that we have configured within IIS., This will make the site offline, unload the application domain from the server, and stop processing any new incoming requests for that application.It will serve the contents of the app_offline.htm file in response to all new dynamic requests for the application.

How we make the site online?

Once we rename/remove the App_offline.htm file, the next request into the application will cause ASP.NET to load the application and app-domain again, and it will be back to normal.
This feature is first introduced in ASP.NET 2.0 and it is available now in all the later versions.
Just give the App_offline.htm page's content as follows.  This will be displayed for every request to that domain.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""><html xmlns=""><head>    <title></title></head><body>    <h1>        WEBSITE IS UNDER MAINTENANCE</h1></body></html>

Kindly share your feedback.


Popular posts from this blog

Dynamically Creating Image in C#.Net


Data Table Vs List