1

I have a website, lets assume it's

www.mydomain.com/a

I also have a page named

list.aspx

I added configuration settings to the web.config file to customize the errors (mainly 404,500).

It works perfectly except for when the request is not a page, for example

 www.mydomain.com/a/lEst.aspx    //my custom page appears
 www.mydomain.com/a/list         //doesn't work   (without aspx extension)
 www.mydomain.com/B/aasd.aspx    //doesn't work

When the custom errors that don't work, the hosting server displays his own custom page.

How can I fix this?

1 Answer 1

1

customErrors in system.web will work only with ASP.Net extensions because it is ahndled by ASP.Net worker process. If you are using IIS7, user system.Webserver section.

<httpErrors errorMode="Custom" existingResponse="Replace" >
    <remove statusCode="404"/>
    <error statusCode="404" path="/error404.aspx" responseMode="ExecuteURL"/>
</httpErrors>
Sign up to request clarification or add additional context in comments.

4 Comments

it almost worked !!! i've tried it the servers default custom page was replaced !! but it was replaced with "The page cannot be displayed because an internal server error has occurred." why ?? the path is correct ?
the path in my answer is indicative, please use your correct file names
i had a typo ... i meant "the path is correct !" without the "?" it points to my site, my error page in the site directory ... is it ok ?
yes for sure ! and even the custom errors works (when its with .aspx)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.