简体   繁体   中英

IIS default 404 error page not showing while browsing non existing page with.aspx extension

We have an application hosted in IIS. The path is like domainname/ApplicationName/page.aspx . If I browse domainname/ApplicationName/dgdghdhshshs (any non existing pages without extension)it will show the default 404 page. But if I type domainname/ApplicationName/dgdghdhshshs.aspx (added.aspx extension) it will show the asp yellow pages. What I want is if any page or path which is not valid is accessed from browser, it should show the default 404 page. Is there any way for this?

Default 404 error page is coming automatically for other file extensions like.php, .html and.py. only for.aspx its showing yellow pages. Is there any option to bypass this for aspx page also?

For production environment you should set in web.config file something like this:

<customErrors mode="On" defaultRedirect="SomethingWentWrong.aspx">
  <error statusCode="404" redirect="Http404ErrorPage.aspx" />
  <error statusCode="500" redirect="SomethingWentWrong.aspx" />
  <error statusCode="401" redirect="UnauthorizedAccess.aspx" />
</customErrors>

More info about custom errors here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM