Reputation: 431
I have a site which is hosted in ASP.NET environment. The site is currently able to handle .aspx request. If a user request a .aspx page which does not exist in the server, then I can redirect him/her to a generic error page.
Now the problem is if a user make a request for .asp page, for example if a user types
http://wwww.example.com/index.asp
Then the error handler does not work. I want to redirect him/her here,
http://wwww.example.com/index.aspx
How can I achieve this?
Thanks in advance.
Upvotes: 1
Views: 110
Reputation: 33484
For a permanent redirect
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://www.new-url.com/"
OR this
Response.Redirect "http://www.new-url.com/"
Upvotes: 2