web.config inheritance problem

  • Thread starter Thread starter gemel
  • Start date Start date
G

gemel

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
 
IMO, 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
 
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
 

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

Similar Threads


Back
Top