Classic ASP Custom Errors on IIS7/IIS7.5

Classic ASP Custom Errors on IIS7/IIS7.5

UPDATE: If you are also looking for a Classic ASP Error Handling Script, I have pasted my basic one here and if you’re working with ASP components, you might find my Classic ASP Component Detection Script useful.

We recently migrated eighty websites from a Windows Server Standard 2003 (IIS6) to Windows Server Standard 2008 R2 (IIS7.5).

Most of the websites use custom error pages to capture errors and send the error back to us.

Since moving to Server 2K8 R2, all of our custom error scripts started reporting no useful information (for example, Linenumber: 0).

If you are responsible for an IIS installation, I strongly recommend having a copy of the [easyazon_link asin=”0735623643″ locale=”US” new_window=”yes” nofollow=”default” tag=”bomc-21″ add_to_cart=”default” cloaking=”default” localization=”default” popups=”no”]IIS Administrator’s Pocket Consultant[/easyazon_link] around – great for those emergencies!

Attempt 1: Web.Config

Firstly I tried using web.config in my websites root to set the custom error page, this actually worked in so far as the page was called when errors occurred and the website visitors were shown a custom page but none of the error details (error code, line number, error description, etc) are available.

All examples I found online of a web.config showed just a few lines (very frustrating for beginners) so here is my full web.config:


Attempt 2: Set Custom Error Page in IIS

On the server, open up Internet Information Services Manager:

In the left bar expand Sites and click on the website you wish to change the settings for.

In the right window, double click Error Pages

If there is an error page configured for the 500 status code, select the Execute a URL on this site option, enter a path to the custom error page (from the root of the site) – if one doesn’t exist, create one.

If the above doesn’t work, try again but for the 500.100 status code.

For me, this still delivered an empty error object.

Attempt 3: Edit IIS Error Pages Settings / Edit Feature Settings

A screen shot of the options panel in IIS for error page settings

IIS Edit Feature Settings

After reading many pages and much Googling, I found what turned out to be the solution and that is setting the default error page for the entire website in IIS (not the individual error type), to do this:

In the left bar, expand Sites and click on the website you want to change the settings for.

In the right window, double click Error Pages

In the far right bar, click Edit Feature Settings

A box appears in which you select Custom Error Pages, then the path to your error page using the root of your website as the start of the path, then the path type (which should be set to Execute URL)

Unfortunately for me, when I attempted this, I then got an error saying Lock Violation – not the most informative of error messages.  After much research I discovered how to turn this off.

Disabling IIS Lock Violation

To disable IIS Lock Violation, you will need the IIS Configuration Editor which comes pre-packed with IIS7.5 but for earlier versions is available in the addon IIS Administration Pack,which you can download from here:, as I’m using IIS7.5 I will use it as my baseline.

A screen shot of the configuration options in IIS to Disable Lock Violation

How to Disable Lock Violation in IIS

A key factor that baffled me for a while was that I was unable to perform the steps below because I was trying to perform them for the configuration of a specific website – this wouldn’t work for me and I had to do it for the entire IIS:

Open the IIS Manager

Highlight your IIS server in the IIS tree structure (not an individual site)

In the right hand pane double click Configuration Editor

From the drop down list select system.webServer/httpErrors

Right click on Default Path, from the menu select Section and then Unlock Section

Now try and repeat step 3 for your specific website

Important Note: Obviously making this change is an IIS-wide change so you need to judge for yourself if there are any implications for your websites, this information is provided as-is with no guarantees or warranty and you should do your own research before deciding to follow them.

Bob McKay

About Bob McKay

Bob is a Founder of Seguro Ltd, a full time father and husband, part-time tinkerer-with-wires, coder, Muay Thai practitioner, builder and cook. Big fan of equality, tolerance and co-existence.

Disclosure Policy

6 comments on «Classic ASP Custom Errors on IIS7/IIS7.5»

  1. Rhys says:

    Thank you very much for this. It was doing my head right in!

  2. Bob says:

    Hi Rhys,

    Glad it helped – it did mine in too!


  3. Henry says:

    There is no Configuration Editor on IIS 7

    1. Bob says:

      Hi Henry,

      As per above if your version of IIS doesn’t have Configuration Editor, it is available in the addon IIS Administration Pack, which you can download from here:


  4. Bob says:

    Hi Henry,

    As per above if your version of IIS doesn’t have Configuration Editor, it is available in the addon IIS Administration Pack, which you can download from here:


  5. hi – just stumbled across your site on my way to your component script 😉 nice work!

    but i’m wondering about the “custom error problem” – i’m using a very similar script (IIRC based on one from IIS4) on every asp-site or -subsite via a custom 500.100 in IIS manger’s Error Pages … works up to 2012R2, even 2016TP4.
    what, unfortunately, does not work for me is getting a useful response to an (jquery) ajax-call – in best case crippled file/line/ect info is returned :-/

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.