Can you force .NET to use browser errors?

  • Thread starter Thread starter Stuart Read
  • Start date Start date
S

Stuart Read

Hi,

- I'm running .NET framework 1.1 on win2k server

I'm investigating error pages at the moment. I have found how to:

a) display friendly or real .NET errors in the remote browser, by
editing the "customErrors" section of the machine.config (or
web.config) and setting the value to "On", "Off" or "RemoteOnly".

b) display a custom error file, by adding the "defaultRedirect" entry
to the "customErrors" section and pointing them at custom page for
each type of error, e.g. an error 404 and 500 page.

What i can not seem to do is force a .NET application to use Internet
Explorers error pages, i.e. what you would get with .asp if you have
the browser setting "friendly errors on" ticked.

Does anyone know a way of forcing .NET to use the actual browser error
pages, as generated by "shdoclc.dll"?

I can almost achieve what i desire by adding this entry to the
machine.config:

<customErrors mode="RemoteOnly"
defaultRedirect="res://C:\WINNT\System32\shdoclc.dll/dnserror.htm">
<error statusCode="404"
redirect="res://C:\WINNT\System32\shdoclc.dll/dnserror.htm"/>
</customErrors>

This forces IE to display the desired error page, but i'm not going to
use this method as it relies on users local configration (the location
of the .dll). Any way to force .NET to do this work?

Any help would be greatly appreciated, i can't seem to find any
articles relating to this.
 
ASP.Net runs on the server. You can't force anything to happen on the client
using pure server-side scripting.

....and what are you going to do about non-IE clients?

Cheers
Ken


: Hi,
:
: - I'm running .NET framework 1.1 on win2k server
:
: I'm investigating error pages at the moment. I have found how to:
:
: a) display friendly or real .NET errors in the remote browser, by
: editing the "customErrors" section of the machine.config (or
: web.config) and setting the value to "On", "Off" or "RemoteOnly".
:
: b) display a custom error file, by adding the "defaultRedirect" entry
: to the "customErrors" section and pointing them at custom page for
: each type of error, e.g. an error 404 and 500 page.
:
: What i can not seem to do is force a .NET application to use Internet
: Explorers error pages, i.e. what you would get with .asp if you have
: the browser setting "friendly errors on" ticked.
:
: Does anyone know a way of forcing .NET to use the actual browser error
: pages, as generated by "shdoclc.dll"?
:
: I can almost achieve what i desire by adding this entry to the
: machine.config:
:
: <customErrors mode="RemoteOnly"
: defaultRedirect="res://C:\WINNT\System32\shdoclc.dll/dnserror.htm">
: <error statusCode="404"
: redirect="res://C:\WINNT\System32\shdoclc.dll/dnserror.htm"/>
: </customErrors>
:
: This forces IE to display the desired error page, but i'm not going to
: use this method as it relies on users local configration (the location
: of the .dll). Any way to force .NET to do this work?
:
: Any help would be greatly appreciated, i can't seem to find any
: articles relating to this.
 
I've been doing some more experimentation and I think my original
question was a little off the mark, sorry for this.

Seems that the IE generated error pages are only displayed when the
browser does not get a response from the server, or the server isn't
IIS. For example, browse a non existant url and you get IE's "not
found" error. However, browse for a non-existant page on an existing
IIS hosted site, and you get the IIS "404b" file. This IIS file is
stored on the web server c:\winnt\help\iisHelp\Common\404b.htm.

Now .. .NET "customErrors" only works if you set the "redirect" to a
URL, it will not work with a UNC path.

Any idea how we can get .NET to use these IIS error pages, without
having to copy them into a website and then supply that URL to the
machine.config "customErrors" section?
 
Add a virtual directory that points to %systemroot%\help\iisHelp\common\

(you should already be able to see this if you have a look at the "default
website" - there's a virtual directory called "IISHelp" that's mapped, which
is how the 500-100 error handler page works for Classic ASP errors).

For additionally sites, you get the "default" response, not the files from
the iisHelp folder - you need to add a similar virtual directory.

Cheers
Ken

: I've been doing some more experimentation and I think my original
: question was a little off the mark, sorry for this.
:
: Seems that the IE generated error pages are only displayed when the
: browser does not get a response from the server, or the server isn't
: IIS. For example, browse a non existant url and you get IE's "not
: found" error. However, browse for a non-existant page on an existing
: IIS hosted site, and you get the IIS "404b" file. This IIS file is
: stored on the web server c:\winnt\help\iisHelp\Common\404b.htm.
:
: Now .. .NET "customErrors" only works if you set the "redirect" to a
: URL, it will not work with a UNC path.
:
: Any idea how we can get .NET to use these IIS error pages, without
: having to copy them into a website and then supply that URL to the
: machine.config "customErrors" section?
 
Back
Top