Custom 503 Error Page IIS? Possible to say something other than service unavailable?

Posted on 2005-04-10
Last Modified: 2008-09-05
I have been through the list of custom errors in IIS but it does not appear to allow you to specify a custom page for a 503 service unavailable there any way of doing this? Is the default service unaviailble page on disk somewhere or auto-generated?
Question by:jbreg
    LVL 6

    Expert Comment

    This may be a start: (Pulled from the IIS help file)

    Creating Custom ASP Error Messages
    If you develop an application using Internet Server API (ISAPI) or Active Server Pages (ASP) to handle errors, you should customize an error message by mapping to a URL. Note that the error status is handed to the application in the URL parameters, and the application must set the HTTP header status. Otherwise, the HTTP response status is "HTTP 1.1 200 OK."

    If you map a custom error message to an ASP file, you must use Server.HTMLEncode to encode your output to avoid cross-site scripting vulnerabilities. Malicious users can send false headers that contain characters like < > " ' % ; ) ( & + - to inject script into the response that is compiled by your ASP custom error file. For example, if you use a header to generate a personal greeting, HTML-encode your output as shown the following example:

    <%@ LANGUAGE="VBScript" %>
      Response.CodePage = 1252
      Response.Write("Hello, " & Server.HTMLEncode(Request.Form("UserName")));
      Response.Write("This is why you received an error:");

    An alternate solution is to add a function to your ASP custom error file that uses the Regular Expression object of Windows Script Host to remove potentially harmful characters from a string that is sent to the function. The following two ASP examples contain such a function. The first example is written in Microsoft Visual Basic® Scripting Edition (VBScript), and the second example is written in Microsoft JScript®:

    <%@ LANGUAGE="VBScript" %>
      Response.CodePage = 1252
      Response.Write("Hello, " & RemoveBadCharacters(Request.Form("UserName")))
      Response.Write("<BR>This is why you received an error:")

      Function RemoveBadCharacters(strTemp)
        Dim regEx
        Set regEx = New RegExp
        regEx.Pattern = "[^\s\w]"
        regEx.Global = True
        RemoveBadCharacters = regEx.Replace(strTemp, "")
      End Function

    <%@ LANGUAGE="JScript" %>
      Response.CodePage = 1252;
      Response.Write("Hello, " + RemoveBadCharacters(Request.Form("UserName")));
      Response.Write("<BR>This is why you received an error:");

      function RemoveBadCharacters(strTemp) {
        strTemp = strTemp.replace(/[^\s\w]/g,");
        return strTemp;

    In both examples above, the code page is specified to ensure proper encoding.

    Related Topics
    For information on how to use the 500-100.asp custom error file to process ASP errors, see Enabling ASP Error Processing.


    © 1997-2003 Microsoft Corporation. All rights reserved
    LVL 8

    Expert Comment


    The problem is how does a server that is unavailable manage to make a response at all?

    The initial filters or http.sys must have some default html it spits out when generating th 503 due to not being able to forward the request to the appropriate server process. So where does it get the HTML for the response and can it be modified.

    You'll notice in the custom errors tab there is no entry for 503.



    Author Comment

    Is there an easier way? I don't really want to get into this asp business, just to specify a template--and we do not handle errors in our web application anyway--IIS handles those. I have specified custom errors via IIS Manager but can't find one for 503--where is it? Why is it not there?
    LVL 6

    Expert Comment

    True but it has to be genereated from somewhere?

    I will continue to dig.

    Author Comment

    Anthony, could not have said it better myself--either that is an autogenerated page or there is a template somewhere. Or maybe there is some other way of specifying the output of 503....
    LVL 6

    Expert Comment

    It must be on the local pc that is trying to access the server. I am looking for its location now.
    LVL 6

    Expert Comment

    Try this: (Obtained from
    Here are some of the more common errors:

    400 Bad Request
    401 Authorization Required
    403 Forbidden
    404 File Not Found
    405 Method Not Allowed
    500 Internal Server Error
    501 Method Not Implemented
    502 Bad Gateway
    503 Service Temporarily Unavailable

    Once you've created your pages, you'll need to access your server via FTP and create a new folder called "errordocs" where you store your HTML files. Upload your new error documents into your new folder.

    Your next step will be to locate your .htaccess file and download it to your computer. (If you use FrontPage to publish your web pages, you cannot customize the .htaccess file, as FrontPage uses the .htaccess file. Editing the file may cause errors in your configuration.) The .htaccess file should be located on your server where you store your HTML files.

    If the .htaccess file isn't visible, you can create one within a plain text editor. However, you must first make sure your server isn't configured to hide the file. Your FTP program should enable you to choose to display hidden files and folders on your server.

    Once you've downloaded your .htaccess file, open it within a plain text editor, such as Note Pad, and add the following lines below any other text that may be present:

    ErrorDocument 400 /errordocs/400.html
    ErrorDocument 401 /errordocs/401.html
    ErrorDocument 403 /errordocs/403.html
    ErrorDocument 404 /errordocs/404.html
    ErrorDocument 405 /errordocs/405.html
    ErrorDocument 500 /errordocs/500.html
    ErrorDocument 501 /errordocs/501.html
    ErrorDocument 502 /errordocs/502.html
    ErrorDocument 503 /errordocs/503.html

    If you're creating your own .htaccess file, open a plain text editor and add the above lines.

    When typing in the information, make certain you type it exactly as it appears above. You can include the error documents of your choice.

    Once the file is complete, save it as .htaccess and upload it to your server, via FTP in ASCII mode, where you store your HTML files.
    LVL 14

    Accepted Solution

    according to Microsoft IIS doco, "The following errors are not customizable: 400, 403.9, 411, 414, 500, 500.11, 500.14, 500.15, 501, 503, and 505."
    I think http.sys itself is responsible for generating this error.

    It is mentioned in the article posted by cjinsocal581 that the instructions are for Unix/Linux server running Apache..
    LVL 34

    Expert Comment

    Alimu is dead on.

    The 503 error message is *not* customizable.

    Dave Dietz
    LVL 6

    Expert Comment


    Author Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Here are the symptoms: You start receiving calls from users that one of your legacy web apps isn't coming up, so you log into your IIS 5 server to check it out.  When you pull up the services, you notice that the WWW Publishing service isn't runn…
    What is an ISAPI filter?   •      It's an assembly (.dll file) that can add or change the way IIS works.   •      They can be enabled globally for your web server or on a site-by-site basis.   When the IIS server receives a request, enabling the ISAPI fi…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now