Wednesday, March 28, 2012

web.config inheritance problem

In the web.config folder at the root of my VS project I have the
following section:

<customErrors mode="On">
<error statusCode="404" redirect "404.aspx" />
</customErrors mode
When access to a non-existent page is made from any aspx file in the
root then this 404.aspx page is execited as required.

However, I now put an aspx page in a subfolder and tried to access a
non-existent page from there and I now get the standard error. The
subfolder does not seem to be inheriting the setting in the web.config
in the parent.

Maybe it is looking for the 404.aspx file to be in the same folder as
the aspx file that generated it.

Any help please!

John LIMO, you forgot to include the path information in the redirect attribute
making it search in the current direcrtory.

Try :

redirect="~/MyCustomErrors/404.aspx" instead...

Patrice

--

"gemel" <jonel@.glenavon1.demon.co.uk> a crit dans le message de
news:9n2tt0dnen7k9v1ov913c7vuf3gia2jdhv@.4ax.com...
> In the web.config folder at the root of my VS project I have the
> following section:
> <customErrors mode="On">
> <error statusCode="404" redirect "404.aspx" />
> </customErrors mode>
> When access to a non-existent page is made from any aspx file in the
> root then this 404.aspx page is execited as required.
> However, I now put an aspx page in a subfolder and tried to access a
> non-existent page from there and I now get the standard error. The
> subfolder does not seem to be inheriting the setting in the web.config
> in the parent.
> Maybe it is looking for the 404.aspx file to be in the same folder as
> the aspx file that generated it.
> Any help please!
> John L
John,
Works fine for me here, though you can always try "~/404.aspx"

The only other thing I can think of is that the subdirectory in question is
marked as an application or a virtual directory in IIS...what happens if
you use a fake sub-directory?

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/

"gemel" <jonel@.glenavon1.demon.co.uk> wrote in message
news:9n2tt0dnen7k9v1ov913c7vuf3gia2jdhv@.4ax.com...
> In the web.config folder at the root of my VS project I have the
> following section:
> <customErrors mode="On">
> <error statusCode="404" redirect "404.aspx" />
> </customErrors mode>
> When access to a non-existent page is made from any aspx file in the
> root then this 404.aspx page is execited as required.
> However, I now put an aspx page in a subfolder and tried to access a
> non-existent page from there and I now get the standard error. The
> subfolder does not seem to be inheriting the setting in the web.config
> in the parent.
> Maybe it is looking for the 404.aspx file to be in the same folder as
> the aspx file that generated it.
> Any help please!
> John L

0 comments:

Post a Comment