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


<httpErrors errorMode="Custom">

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

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



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

error path="/"
error path="/errorpage.htm"
error path="/404.aspx"

etc etc.
  • 5 Users Found This Useful
Was this answer helpful?

Related Articles

Web.config file does not run

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

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...

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)...

Cross-Site Scripting in ASP.NET

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

301 redirect using global.asax.cs

Below is code to do 301 redirect using the global.asax.cs file.   ...