SolveErrors
ASP

Get actual URL from address bar in Classic ASP on a 404 redirected page

89 views

I need to catch URLs that don't exist on my website and redirect them to relevant pages that do exist.

I have set up a custom 404 page on the web server and then in the 404 I look at the URL, decide where it should be going and then forward the page as follows:

Response.Status = "301 Moved Permanently"
Response.AddHeader("Location",thisPageString)

Where thisPageString is the new page URL.

However, when I access the page URL with...

Request.ServerVariables("PATH_INFO") 

...I get the current actual URL = "/404.asp"; when what I actually need is the original URL for the non-existent page shown in the address bar.

How do I access that?

Thanks.

More ASP fixes

IIS: web.config redirect to another url preserving the original one in the address barRequested operation requires a current record.asp guestbook w/ textfileguestbook enties - tutorialsadd asp.net pages to an asp classic websitesimple asp based guestbook