Request.serverVariables () "URL" vs "Script_Name"

I support the classic asp application and, looking at the code, I came across two similar lines of code:

Request.ServerVariables("URL") ' Output: "/path/to/file.asp" Request.ServerVariables("SCRIPT_NAME") ' Output: "/path/to/file.asp" 

I donโ€™t understand ... what's the difference? both of them ignore the rewritten URL that I set, which places the / path folder as the root document (the above URL is rewritten to "/to/file.asp")

Additional Information : Site deployed on IIS 7

+4
source share
3 answers

This may be a bug in IIS 7.

I could not get Request.ServerVariables("URL") and Request.ServerVariables("SCRIPT_NAME") to return different values. I tried cases when they were called from the included file ( <!--#include file="file.asp"--> ) or after Server.Transfer .

+3
source

URL Gets the base portion of the URL without any queries or additional path information. For raw URLs, use HTTP_URL or UNENCODED_URL.

SCRIPT_NAME A virtual script path is being executed. Can be used for self-referencing URLs.

See http://www.requestservervariables.com/url and / script _name for definitions.

+7
source

Perhaps this is possible in the case of Server.Transfer?

In the case when you do server.transfer, I think you will get different results.

i.e. SCRIPT_NAME will, for example, /path/to.transferredfile.asp, while the URL will remain as / path / to / file.asp

+1
source

All Articles