C#中Request.ServerVariables詳細說明及代理

來源:互聯網
上載者:User

ServerVariables是環境變數的集合。允許讀取HTTP頭。你可以通過使用HTTP_首碼來讀取任何頭資訊。

Request.ServerVariables["Url"]
返回伺服器位址

Request.ServerVariables["Path_Info"]
用戶端提供的路徑資訊

Request.ServerVariables["Appl_Physical_Path"]
與應用程式中繼資料庫路徑相應的實體路徑

Request.ServerVariables["Path_Translated"]
通過由虛擬至物理的映射後得到的路徑

Request.ServerVariables["Script_Name"]
執行指令碼的名稱

Request.ServerVariables["Query_String"]
查詢字串內容

Request.ServerVariables["Http_Referer"]
請求的字串內容

Request.ServerVariables["Server_Port"]
接受請求的伺服器連接埠號碼

Request.ServerVariables["Remote_Addr"]
發出請求的遠程主機的IP地址

Request.ServerVariables["Remote_Host"]
發出請求的遠程主機名稱

Request.ServerVariables["Local_Addr"]
返回接受請求的伺服器位址

Request.ServerVariables["Http_Host"]
返回伺服器位址

Request.ServerVariables["Server_Name"]
伺服器的主機名稱、DNS地址或IP地址

Request.ServerVariables["Request_Method"]
提出請求的方法比如GET、HEAD、POST等等

Request.ServerVariables["Server_Port_Secure"]
如果接受請求的伺服器連接埠為安全連接埠時,則為1,否則為0

Request.ServerVariables["Server_Protocol"]
伺服器使用的協議的名稱和版本

Request.ServerVariables["Server_Software"]
應答請求並運行網關的伺服器軟體的名稱和版本

Request.ServerVariables["All_Http"]
用戶端發送的所有HTTP標題,首碼HTTP_

Request.ServerVariables["All_Raw"]
用戶端發送的所有HTTP標題,其結果和用戶端發送時一樣,沒有首碼HTTP_

Request.ServerVariables["Appl_MD_Path"]
應用程式的中繼資料庫路徑

Request.ServerVariables["Content_Length"]
用戶端發出內容的長度

Request.ServerVariables["Https"]
如果請求穿過安全通道(SSL),則返回ON如果請求來自非安全通道,則返回OFF

Request.ServerVariables["Instance_ID"]
IIS執行個體的ID號

Request.ServerVariables["Instance_Meta_Path"]
響應請求的IIS執行個體的中繼資料庫路徑

Request.ServerVariables["Http_Accept_Encoding"]
返回內容如:gzip,deflate

Request.ServerVariables["Http_Accept_Language"]
返回內容如:en-us

Request.ServerVariables["Http_Connection"]
返回內容:Keep-Alive

Request.ServerVariables["Http_Cookie"]
返回內容如:nVisiT%

2DYum=125;ASPSESSIONIDCARTQTRA=FDOBFFABJGOECBBKHKGPFIJI;ASPSESSIONIDCAQQTSRB=LKJJPLABABILLPCOGJGAMKAM;ASPSESSIONIDACRRSSRA=DK

HHHFBBJOJCCONPPHLKGHPB

Request.ServerVariables["Http_User_Agent"]
返回內容:Mozilla/4.0(compatible;MSIE6.0;WindowsNT5.1;SV1)

Request.ServerVariables["Https_Keysize"]
安全通訊端層串連關鍵字的位元,如128

Request.ServerVariables["Https_Secretkeysize"]
伺服器驗證私人關鍵字的位元如1024

Request.ServerVariables["Https_Server_Issuer"]
伺服器憑證的發行者欄位

Request.ServerVariables["Https_Server_Subject"]
伺服器憑證的主題欄位

Request.ServerVariables["Auth_Password"]
當使用基本驗證模式時,客戶在密碼對話方塊中輸入的密碼

Request.ServerVariables["Auth_Type"]
是使用者訪問受保護的指令碼時,伺服器用於檢驗使用者的驗證方法

Request.ServerVariables["Auth_User"]
代證的使用者名稱

Request.ServerVariables["Cert_Cookie"]
唯一的客戶認證ID號

Request.ServerVariables["Cert_Flag"]
客戶認證標誌,如有用戶端認證,則bit0為0如果用戶端認證驗證無效,bit1被設定為1

Request.ServerVariables["Cert_Issuer"]
使用者認證中的發行者欄位

Request.ServerVariables["Cert_Keysize"]
安全通訊端層串連關鍵字的位元,如128

Request.ServerVariables["Cert_Secretkeysize"]
伺服器驗證私人關鍵字的位元如1024

Request.ServerVariables["Cert_Serialnumber"]
客戶認證的序號欄位

Request.ServerVariables["Cert_Server_Issuer"]
伺服器憑證的發行者欄位

Request.ServerVariables["Cert_Server_Subject"]
伺服器憑證的主題欄位

Request.ServerVariables["Cert_Subject"]
用戶端認證的主題欄位

Request.ServerVariables["Content_Type"]
客戶發送的form內容或HTTPPUT的資料類型

Request.ServerVariables["HTTP_X_FORWARDED_FOR"]
可以獲得位於代理(網關)後面的直接IP,當然必須這個代理支援

一些被隱藏起來的Request.ServerVariables參數:
Request.ServerVariables["NUMBER_OF_PROCESSORS"]
Request.ServerVariables["OS"]
Request.ServerVariables["WINDIR"]
Request.ServerVariables["TEMP"]
Request.ServerVariables["TMP"]
Request.ServerVariables["ComSpec"]
Request.ServerVariables["Os2LibPath"]
Request.ServerVariables["Path"]
Request.ServerVariables["PATHEXT"]
Request.ServerVariables["PROCESSOR_ARCHITECTURE"]
Request.ServerVariables["PROCESSOR_IDENTIFIER"]
Request.ServerVariables["PROCESSOR_LEVEL"]
Request.ServerVariables["PROCESSOR_REVISION"]

本機ip:<%=request.servervariables["remote_addr"]%>
伺服器名:<%=Request.ServerVariables["SERVER_NAME"]%>
伺服器IP:<%=Request.ServerVariables["LOCAL_ADDR"]%>
伺服器連接埠:<%=Request.ServerVariables["SERVER_PORT"]%>
伺服器時間:<%=now%>
IIS版本:<%=Request.ServerVariables["SERVER_SOFTWARE"]%>
指令碼逾時時間:<%=Server.ScriptTimeout%>
本檔案路徑:<%=server.mappath(Request.ServerVariables["SCRIPT_NAME"])%>
伺服器CPU數量:<%=Request.ServerVariables["NUMBER_OF_PROCESSORS"]%>
伺服器解譯引擎:<%=ScriptEngine & "/"& ScriptEngineMajorVersion&"."&ScriptEngineMinorVersion&"."& ScriptEngineBuildVersion %>
伺服器作業系統:<%=Request.ServerVariables["OS"]%>
支援的檔案類型:<%=Request.ServerVariables["HTTP_Accept"]%>
訪問的檔案路徑:<%=Request.ServerVariables["HTTP_url"]%>
使用者代理程式的資訊:<%=Request.ServerVariables["HTTP_USER_AGENT"]%>

Request.ServerVariables變數意義. http代理相關知識
Request.ServerVariables["HTTP_VIA"]---------可以獲得使用者內部的ip
Request.ServerVariables["HTTP_X_FORWARDED_FOR"]---------可以知道Proxy 伺服器的伺服器名以及連接埠
Request.ServerVariables["REMOTE_ADDR"]-- 發出請求的遠程主機的 IP 位址。

http代理相關知識
關鍵就在HTTP_X_FORWARDED_FOR
使用不同種類Proxy 伺服器,上面的資訊會有所不同:

一、沒有使用Proxy 伺服器的情況:
REMOTE_ADDR = 您的 IP
HTTP_VIA = 沒數值或不顯示
HTTP_X_FORWARDED_FOR = 沒數值或不顯示

二、使用透明Proxy 伺服器的情況:Transparent Proxies
REMOTE_ADDR = Proxy 伺服器 IP
HTTP_VIA = Proxy 伺服器 IP
HTTP_X_FORWARDED_FOR = 您的真實 IP
這類Proxy 伺服器還是將您的資訊轉寄給您的訪問對象,無法達到隱藏真實身份的目的。

三、使用普通匿名Proxy 伺服器的情況:Anonymous Proxies
REMOTE_ADDR = Proxy 伺服器 IP
HTTP_VIA = Proxy 伺服器 IP
HTTP_X_FORWARDED_FOR = Proxy 伺服器 IP
隱藏了您的真實IP,但是向訪問對象透露了您是使用Proxy 伺服器訪問他們的。

四、使用欺騙性Proxy 伺服器的情況:Distorting Proxies
REMOTE_ADDR = Proxy 伺服器 IP
HTTP_VIA = Proxy 伺服器 IP
HTTP_X_FORWARDED_FOR = 隨機的 IP
告訴了訪問對象您使用了Proxy 伺服器,但編造了一個虛假的隨機IP代替您的真實IP欺騙它。

五、使用高匿名Proxy 伺服器的情況:High Anonymity Proxies (Elite proxies)
REMOTE_ADDR = Proxy 伺服器 IP
HTTP_VIA = 沒數值或不顯示
HTTP_X_FORWARDED_FOR = 沒數值或不顯示

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.