locked
I want to show 404 error instead of 500 error in IIS 7 if page request is like https://www.google.com/page/car/1. (file with just . with missing extension) RRS feed

All replies

  • User665608656 posted

    Hi Kumar,

    Are you currently using an asp.net project or a mvc project?

    I suggest that you provide us with the details of the current 500 errors.

    Best Regards,

    YongQing.

    Monday, December 30, 2019 8:37 AM
  • User346830450 posted

    Currently I'm using Asp.Net project.

    In the production IIS logs is see 500 errors which are mostly because of some bad requests as I suggested  "https://www.mysitecom/page/car/1. "

    Upon investigating I was able to trace it back to internal security tool which is randomly doing the health check by randomly ping the url's.

    So I want to handle these errors are handled errors.

     

    Monday, December 30, 2019 7:27 PM
  • User665608656 posted

    Hi Kumar,

    Have you tried testing in your local environment and using that url to see what error messages it will prompt?

    Usually, when you lack the extension, you will get a 404 error reminder, so we guess this may be related to your IIS.

    So we hope you can provide us with the details of the 500 errors so that we can help us solve your problem faster.

    Best Regards,

    YongQing.

    Tuesday, December 31, 2019 8:59 AM
  • User346830450 posted

    I was able to fix the isssue by updating the httpError node in web.config. Now I dont get http -500 error instead of 404.  

    <httpErrors errorMode="DetailedLocalOnly">

                     <remove statusCode="404" />

                     <error statusCode="404" path="/views/home/page_not_found.aspx" responseMode="Redirect" />

    </httpErrors>

    Friday, January 10, 2020 6:31 PM