Monday, March 11, 2013

What is app_offline.htm?

When you are working in Visual Studio and usually when you are setting some kind of data source, Visual Studio creates the app_offline.htm file. Usually it deletes itself when you are finished or closing Visual Studio. You can also set up a custom app_offline.htm file to upload to the actual web server when you are doing maintenance or modifications. The app_offline.htm is a new feature in ASP.NET 2.0 which enables you to take the application off line temporary for example to deploy something or make it inaccessible for sometime. Once you 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 life will continue along as normal.

What is inside (code) the app_offline.htm file?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Application Offline</title>
    <style  type="text/css">

    div {
        background-color:#ffffcc;
        padding-top:10px;
        padding-bottom:10px;
        padding-left:10px;
        padding-right:10px;   
        border-style:solid;
        border-color:Black;
        border-width:1px;
    }

    </style>
</head>
<body>
    <div>
        This application is currently offline.  To enable the application, remove the
        app_offline.htm file from the application root directory.
    </div>
</body>
</html>

No comments: