C#获取url/路径方法

[pre]HttpContext.Current.Request.Url[/pre]

Request.ServerVariables["HTTP_HOST"] + Request.ServerVariables["SCRIPT_NAME"]

Request.ApplicationPath: /testweb
Request.CurrentExecutionFilePath: /testweb/default.aspx
Request.FilePath: /testweb/default.aspx
Request.Path: /testweb/default.aspx
Request.PathInfo:
Request.PhysicalApplicationPath: E:/WWW/testweb/
Request.PhysicalPath: E:/WWW/testweb/default.aspx
Request.RawUrl: /testweb/default.aspx
Request.Url.AbsolutePath: /testweb/default.aspx
Request.Url.AbsoluteUri: http://www.test.com/testweb/default.aspx
Request.Url.Host: www.test.com
Request.Url.LocalPath: /testweb/default.aspx
ALL_HTTP HTTP_CONNECTION:Keep-Alive
HTTP_ACCEPT:**
Accept-Encoding: gzip, deflate
Accept-Language: zh-cn
Host: www.ccopus.com
Referer: http://www.baidu.com/baidu?wd=servervariables&cl=3
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; TencentTraveler ; .NET CLR 1.1.4322)

APPL_MD_PATH /LM/W3SVC/1201924191/Root
APPL_PHYSICAL_PATH D:/WebRoot/sunrise_chen/www.ccopus.com/
AUTH_PASSWORD
AUTH_TYPE
AUTH_USER
CERT_COOKIE
CERT_FLAGS
CERT_ISSUER
CERT_KEYSIZE
CERT_SECRETKEYSIZE
CERT_SERIALNUMBER
CERT_SERVER_ISSUER
CERT_SERVER_SUBJECT
CERT_SUBJECT
CONTENT_LENGTH 0
CONTENT_TYPE
GATEWAY_INTERFACE CGI/1.1
HTTPS off
HTTPS_KEYSIZE
HTTPS_SECRETKEYSIZE
HTTPS_SERVER_ISSUER
HTTPS_SERVER_SUBJECT
INSTANCE_ID 1201924191
INSTANCE_META_PATH /LM/W3SVC/1201924191
LOCAL_ADDR 61.129.112.41
LOGON_USER
PATH_INFO /code/servervariables.asp
PATH_TRANSLATED D:

你可能感兴趣的:(C#)