Search:
Namespaces
Discussions
.NET v1.1
Feedback
customErrors
Messages
Related Types
This message was discovered on
ASPFriends.com 'aspngconfig' list
.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Tim Heuer (VIP)
-- Copied from [aspngfreeforall] to [aspngconfig] by Marcie Jones <
Click here to reveal e-mail address
> --
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------=_NextPartTM-000-f08eab3e-e4d8-4d9d-ae61-3cf1e96512fe
Content-Type: multipart/alternative;
boundary="----_=_NextPart_001_01C1E650.AD04A720"
------_=_NextPart_001_01C1E650.AD04A720
Content-Type: text/plain
Here's my problem...
I am using the <customErrors> attribut in the configuration file, along with
an <error statusCode="404"> specific redirection for page not found errors.
This works fine when a specific page is not found (i.e., the user requests
http://server/directory/page1.aspx
<
http://server/directory/page1.aspx
> ),
but if any other page is requested,
http://server/directory/page2.asp
<
http://server/directory/page2.asp
> , it displays the older 404 error
message and not the custom one. Likewise if the user requests a directory
that doesn't exist (which would gen a 404 error) it does not show the custom
error page.
I know that .asp and .aspx files will be handled by different runtimes
unless configured differently, what I am looking for is confirmation that
<customErrors> *only* applies to specifically requested .aspx pages...and if
that is the case...ouch it really doesn't help solve the other areas (yes I
know I can change the IIS settings, but I won't get the "aspxerrorpath" and
other attributes passed in the querystring, nor does this allow the
flexibility of having a single point of configuration).
Tim
__________________________
Tim Heuer
(480) 317-8724
Click here to reveal e-mail address
------_=_NextPart_001_01C1E650.AD04A720
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2652.35">
<TITLE>customErrors</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=3D2 FACE=3D"Tahoma">Here's my problem...</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Tahoma">I am using the <customErrors> =
attribut in the configuration file, along with an <error =
statusCode=3D"404"> specific redirection for page not =
found errors. This works fine when a specific page is not found =
(i.e., the user requests </FONT><A =
HREF=3D"
http://server/directory/page1.aspx
"><U><FONT COLOR=3D"#0000FF" =
SIZE=3D2 =
FACE=3D"Tahoma">
http://server/directory/page1.aspx
</FONT></U></A><FONT =
SIZE=3D2 FACE=3D"Tahoma">), but if any other page is requested, =
</FONT><A HREF=3D"
http://server/directory/page2.asp
"" target="_blank">
http://server/directory/page2.asp
"><U><FONT =
COLOR=3D"#0000FF" SIZE=3D2 =
FACE=3D"Tahoma">
http://server/directory/page2.asp
</FONT></U></A><FONT =
SIZE=3D2 FACE=3D"Tahoma">, it displays the older 404 error message and =
not the custom one. Likewise if the user requests a directory =
that doesn't exist (which would gen a 404 error) it does not show the =
custom error page.</FONT></P>
<P><FONT SIZE=3D2 FACE=3D"Tahoma">I know that .asp and .aspx files will =
be handled by different runtimes unless configured differently, what I =
am looking for is confirmation that <customErrors> *only* applies =
to specifically requested .aspx pages...and if that is the case...ouch =
it really doesn't help solve the other areas (yes I know I can change =
the IIS settings, but I won't get the "aspxerrorpath" and =
other attributes passed in the querystring, nor does this allow the =
flexibility of having a single point of configuration).</FONT></P>
<P><FONT SIZE=3D2 FACE=3D"Tahoma">Tim</FONT>
</P>
<P><FONT COLOR=3D"#000080" SIZE=3D1 =
FACE=3D"Tahoma">__________________________</FONT>
<BR><FONT COLOR=3D"#800000" SIZE=3D1 FACE=3D"Tahoma">Tim Heuer</FONT>
<BR><FONT COLOR=3D"#000080" SIZE=3D1 FACE=3D"Tahoma">(480) =
317-8724</FONT>
<BR><FONT COLOR=3D"#000080" SIZE=3D1 =
FACE=3D"Tahoma">
Click here to reveal e-mail address
</FONT>
</P>
<BR>
</BODY>
</HTML>
------_=_NextPart_001_01C1E650.AD04A720--
------=_NextPartTM-000-f08eab3e-e4d8-4d9d-ae61-3cf1e96512fe--
Reply to this message...
James Shaw (VIP)
You're right. Only files mapped to ASP.NET will be trapped by
<customerrors>.
I also map my IIS to the same aspx file to handle other non-ASP.NET files,
and handle it with the following code (actually this may be old code since
I'm not at my real dev machine...):
private void Page_Load(object sender, System.
EventArgs
e)
{
// there are two ways that the 404 is passed to us:
// 1. by ASP.NET as a aspxerrorpath querystring, or
// 2. by IIS as a 404;path querystring
string sRequest = Request.QueryString["aspxerrorpath"];
if (null == sRequest)
{
sRequest = Request.QueryString.ToString();
if (null != sRequest && sRequest.length > 6)
{
// for some reason the URL comes in like this:
// 404%3bhttp%3a%2f%2flocalhost%2fOLN%2fsdfsdg
// not like this:
// 404;
http://localhost/oln/sdfsdg
sRequest = Server.UrlDecode(sRequest.Substring(6));
}
else
{
sRequest = null;
}
}
// blah, blah
}
James Shaw
http://CoverYourASP.com/
Download it. Run it. Learn it.
http://ASPRSS.com/
Publish ASP with RSS XML
http://ShawThing.com/Consult.asp
Doing it right the first time.
----- Original Message -----
From: "Tim Heuer" <
Click here to reveal e-mail address
>
To: "aspngconfig" <
Click here to reveal e-mail address
>
Sent: Wednesday, April 17, 2002 4:44 PM
Subject: [aspngconfig] customErrors
> -- Copied from [aspngfreeforall] to [aspngconfig] by Marcie Jones
<
Click here to reveal e-mail address
> --
[Original message clipped]
Reply to this message...
Mike VD
You can map any file extension to the ASPNET runtime to have these pages use your custom error pages.
Although I don't know what impact this has on system performance, if any.
Go To IIS Manager
[Original message clipped]
You will now see the mappings for all file extensions.
Click on the .asp or .aspx file extension and click edit.
Copy the values from the Executable: and Limit To: fields.
Add a new mapping and paste these values into the new mappings fields and also enter the file extension for the type of file you want to catch 404 errors for.
--------------------------------
From: Mike VD
Reply to this message...
System.EventArgs
Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us
-
Terms of Use
-
Privacy Policy
-
www.dotnet247.com