About ASP.NET 2.0 app_offline.htm

About app_offline

Basically, if you place a file with this name in the root of a web application directory, ASP.NET 2.0 will shut-down the application, unload the application domain from the server, and stop processing any new incoming requests for that application. ASP.NET will also then respond to all requests for dynamic pages in the application by sending back the content of the app_offline.htm file (for example: you might want to have a “site under construction” or “down for maintenance” message).

This provides a convenient way to take down your application while you are making big changes or copying in lots of new page functionality (and you want to avoid the annoying problem of people hitting and activating your site in the middle of a content update).  It can also be a useful way to immediately unlock and unload a SQL Express or Access database whose .mdf or .mdb data files are residing in the /app_data directory.

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.

Issue app_offline.htm: Showing Image

Image won’t be displayed in the app_offline.htm. Any image include in the image tag or inside of style as background image is blocked in the app_offline.htm

How to fix?

Change the image file src to real image base64 code.

For example:

CSS

.block
{
width: 550px;
height: 220px;
background: url(“data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA…………………….”) no-repeat;
margin-top: 5%;
padding-top: 40px;
}

Image Tag

<img  src=”data:image/png;base64,iVBORw0KGgoAAAAAA8CA…………”/>

How to convert image file to base64?

Go to [this site]: upload your file -> grab the base64 code string


Advertisements

1 Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s