I need to send a Customized Error page for 503 Errors produced by my asp.net website. I have tried to simulate the condition by switching off the application pool (doesn\'t
Ran into the same problems, but I've just managed to get this working for us using a Classic ASP holding page in a .NET application (I'm not sure if it'll work the same for an apsx):
Make sure Classic ASP is enabled in IIS. Worth a read: http://blogs.iis.net/bills/archive/2007/05/21/tips-for-classic-asp-developers-on-iis7.aspx
Create a classic ASP file called Offline.asp and place it in the root of your website with the following contents:
<%
Response.Status = "503 Service Unavailable"
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
%>
Sorry, we're down for essential maintenance
Sorry, we're down for essential maintenance
Now in IIS7 Manager go the Error Pages administration section, add a Custom Error Page like so:



Now whenever IIS receives a 503, it will send the contents of the Offline.asp to the browser, as well as the 503 code (which is important so that Search Engines don't list your error page!)
Now if you want to take your application offline you can just set up a simple redirect rule to redirect everything to Offline.asp.