Custom error pages for HTTP errors with IIS status codes

G

Guest

Hi!

I tried to implement custom error pages using the <customErrors> directive
in a web.config file. It worked fine for "simple" errors like HTTP 404, like
this example:

<customErrors mode="On">
<error statusCode="404"
redirect="http://localhost/ErrorPages/Error404.aspx"/>
</customErrors>

My problem is: I wanted to do that for errors like HTTP 401 (Unauthorized)
as well. But those errors come with additional IIS status codes, e.g. HTTP
401.2 (Unauthorized: Access is denied due to server configuration). So, how
can I target such an error with the aforementioned customErrors directive? I
already tried to enter values like "401.2", "401;2", "401-2", but the
statusCode attribute only accepts integer values. "4012", or just "401" (one
page for all IIS status codes) didn't work as well.

I would really like to use this method, and no "workarounds" like using the
Application_Error event in global.asax.

--
Daniel Kopp
MCP

HUENGSBERG AG
Lilienthalstr. 29
D-85399 Hallbergmoos
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,783
Latest member
RickeyDort

Latest Threads

Top