Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I am maintaining a classic asp application and while going over 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 get it... what is the difference? both of them ignore the URL rewriting that I have set up which puts the /path folder as the root document (the above URL is rewritten to "/to/file.asp")

More info: The site is deployed on IIS 7

like image 828
Jiaaro Avatar asked Mar 27 '09 12:03

Jiaaro


People also ask

What is request ServerVariables?

The ServerVariables collection retrieves the values of predetermined environment variables and request header information. Server variables obtain most of their information from headers. It is wise to not trust the data that is contained in headers, as this information can be falsified by malicious users.

What is request ServerVariables Http_referer?

Firstly, Request. ServerVariables["HTTP_REFERER"] is a correct way to retrieve the information about the url of the client's previous request that linked to the current page.

What is request ServerVariables Remote_addr?

ServerVariables("REMOTE_ADDR") is Always the Same. If your scripts use Request. ServerVariables("REMOTE_ADDR") to get the client's IP address, they will always show the same, internal IP address due to the load balancers used for hosting your site. You can get the client's remote IP using Request.

What is HttpContext current request ServerVariables?

HttpContext.Current.Request.ServerVariables("LOGON_USER") Request.ServerVariables("LOGON_USER") it will work only when Windows Integrated Authentication is turned on and Anonymous. Access is turned off. in this case, the Request.ServerVariables("LOGON_USER") will return the network.


1 Answers

URL Gives the base portion of the URL, without any querystring or extra path information. For the raw URL, use HTTP_URL or UNENCODED_URL.

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

See, http://www.requestservervariables.com/url and /script_name for the definitions.

like image 125
Max Wikström Avatar answered Nov 05 '22 02:11

Max Wikström