Redirect old .asp or any non aspx pages using 404


Add this to the System Webserver section in the web.config file to handle any non .aspx pages


<system.webServer>

<httpErrors errorMode="Custom">

<remove statusCode="404" subStatusCode="-1" />

<error path="/" prefixLanguageFilePath="" responseMode="ExecuteURL" statusCode="404" />

</httpErrors>

</system.webServer>


Just keep in mind that the Error Path section can be set to whatever file you require the error to be redirected to.

Example:
error path="/"
Or
error path="/errorpage.htm"
Or
error path="/404.aspx"

etc etc.
  • Email, SSL
  • 4 Users Found This Useful
Was this answer helpful?

Related Articles

Automatically switching between HTTP and HTTPS protocols without hard-coding absolute URLs

An article on automatically switching between HTTP and HTTPS protocols without hard-coding...

Web.config file does not run

If your web.cofig file doesnt run (Even though the error keeps telling you to modify the...

How to use the session state server (Sessions issues)

If you are having problems loosing sessions please use the session state server. (ASP.NET only)...

How to change DOT NET Version (Site level)

Login to your control panel at http://control.apexhost.net.au Please note: Ensure you set your...

Cross-Site Scripting in ASP.NET

Cross-Site Scripting in ASP.NET Cross-site scripting attacks exploit vulnerabilities in Web page...