10

I'm wondering how to remove the error messages IIS7 adds to the top of the page.

I have my own 500 and 404 error pages served.

Not needing the error pages I have deleted them, but I am still getting this on top of my page:

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable

Any ideas?

Kev
  • 118,037
  • 53
  • 300
  • 385
RadiantHex
  • 24,907
  • 47
  • 148
  • 244

3 Answers3

17

To prevent IIS7 hijacking your error pages, set existingResponse="PassThrough" in your httpErrors section in your web.config file. For example:

<configuration>
  <system.webServer>
    <httpErrors existingResponse="PassThrough" />
  </system.webServer>
</configuration>
Kev
  • 118,037
  • 53
  • 300
  • 385
9

You can also go into IIS manager --> Error Pages then click on the right on "Edit feature settings..." And set the option to "Detailed errors" then it will be your application that process the error and not IIS.

VinnyG
  • 6,883
  • 7
  • 58
  • 76
0

Just for addtional information I'll share what helped me:

<system.webServer>
  <httpErrors errorMode="DetailedLocalOnly">
</system.webServer>

In such setup I could see detailed errors when developing on my local machine, but they would not be shown to users when remote server is accessed from outside.

You could find more information regarding errorMode here.

onestep.ua
  • 118
  • 7