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?

Hilmi
  • 3,411
  • 6
  • 27
  • 55

1 Answers1

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>
PraveenVenu
  • 8,217
  • 4
  • 30
  • 39
  • 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 ? – Hilmi Jul 19 '12 at 06:11
  • the path in my answer is indicative, please use your correct file names – PraveenVenu Jul 19 '12 at 06:22
  • 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 ? – Hilmi Jul 19 '12 at 06:36
  • yes for sure ! and even the custom errors works (when its with .aspx) – Hilmi Jul 19 '12 at 06:57