Since IIS has special processing for a file named 'app_offline.htm' in the root directory of your website, this sentence may not work if you do not rename the file. But, here, anyway ...
You can use the HttpHandler for this. In your web.config add something like this:
<add name="app_offline_GET" path="app_offline.htm" verb="GET" type="namespace.classname,dllname" />
Obviously replace the correct information in the type attribute.
In HttpHandler do something like this:
public void ProcessRequest(HttpContext context) { context.Response.WriteFile("app_offline.htm"); context.Response.StatusCode = 209; context.Response.StatusDescription = "whatever"; }
source share