程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> .NET網頁編程 >> C# >> C#入門知識 >> c#怎麼獲取當前頁面的url,

c#怎麼獲取當前頁面的url,

編輯:C#入門知識

c#怎麼獲取當前頁面的url,


c#怎麼獲取當前頁面的url  

C# code
HttpContext.Current.Request.Url

 

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:

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved