服務(wù)熱線
153 8323 9821
request本身是一個系統(tǒng)的靜態(tài)對象,本身也可以作為數(shù)組調(diào)用,比如
request("abc")
就是獲取request數(shù)組中鍵值"abc"對應(yīng)的值,而這個數(shù)組又不是固定的,而是多個數(shù)組的集合,其中包含了(QueryString ,Form ,Cookies ,ClientCertificate,ServerVariables )
這幾個服務(wù)器變量數(shù)組的值,也就是說,通過request可以依次遍歷這幾個數(shù)組并返回對應(yīng)的值,使用起來很是方便,一勞永逸。
而request.form這個request的成員函數(shù)就不是那么寬泛的取值了,僅僅是從form數(shù)組中取值,也就是頁面表單<form>標(biāo)簽的輸入單元(比如<input type=text >傳遞過來的值。那么通過form就無法獲取鏈接字符串中以index.asp?abc=123這樣的形式傳遞過來的參數(shù)了。
還有一種方法是request.QueryString("abc")這種形式,可以獲取QueryString鏈接字符串傳遞的參數(shù)了。
以http的幾種傳遞數(shù)據(jù)機(jī)制來說,這三種方法可以這樣區(qū)分。request.form可以獲取以post方式提交的數(shù)據(jù),requst.querystring可以獲取以get方法提交的數(shù)據(jù),而request則是可以同時獲取兩種方法傳遞的數(shù)據(jù)。
按照傳遞數(shù)據(jù)量來說,request.form可以傳遞不限大小的數(shù)據(jù),而request.querystring只能傳遞2k的數(shù)據(jù)量。
按照速度來說,request.qeurystring會略快于request.form最方便最好用的嘛,request本身來的直接了,不管怎么傳遞的數(shù)據(jù)都能獲取,性能嘛,略有下降,可忽略不計,通用的可以使用 request("abc")這樣的寫法。
Request.Form:獲取以POST方式提交的數(shù)據(jù)(接收Form提交來的數(shù)據(jù));Request.QueryString:獲取地址欄參數(shù)(以GET方式提交的數(shù)據(jù)) Request:包含以上兩種方式(
優(yōu)先獲取GET方式提交的數(shù)據(jù)),它會在QueryString、Form、ServerVariable中都搜尋一遍。
而且有時候也會得到不同的結(jié)果。如果你僅僅是需要Form中的一個數(shù)據(jù),但是你使用了Request而不是Request.Form,那么程序?qū)⒃赒ueryString、ServerVariable中也搜尋一遍。如果正好你的QueryString或者ServerVariable里面也有同名的項,你得到的就不是你原本想要的值了。
Request.ServerVariables中的各種參數(shù)
Request.ServerVariables("Url")
返回服務(wù)器地址
Request.ServerVariables("Path_Info")
客戶端提供的路徑信息
Request.ServerVariables("Appl_Physical_Path")
與應(yīng)用程序元數(shù)據(jù)庫路徑相應(yīng)的物理路徑
Request.ServerVariables("Path_Translated")
通過由虛擬至物理的映射后得到的路徑
Request.ServerVariables("Script_Name")
執(zhí)行腳本的名稱
Request.ServerVariables("Query_String")
查詢字符串內(nèi)容
Request.ServerVariables("Http_Referer")
請求的字符串內(nèi)容
Request.ServerVariables("Server_Port")
接受請求的服務(wù)器端口號
Request.ServerVariables("Remote_Addr")
發(fā)出請求的遠(yuǎn)程主機(jī)的
IP
地址
Request.ServerVariables("Remote_Host")
發(fā)出請求的遠(yuǎn)程主機(jī)名稱
Request.ServerVariables("Local_Addr")
返回接受請求的服務(wù)器地址
Request.ServerVariables("Http_Host")
返回服務(wù)器地址
Request.ServerVariables("Server_Name")
服務(wù)器的主機(jī)名、
DNS
地址或
IP
地址
Request.ServerVariables("Request_Method")
提出請求的方法比如
GET
、
HEAD
、
POST
等等
Request.ServerVariables("Server_Port_Secure")
如果接受請求的服務(wù)器端口為安全端口時,則為
1
,否則為
0
Request.ServerVariables("Server_Protocol")
服務(wù)器使用的協(xié)議的名稱和版本
Request.ServerVariables("Server_Software")
應(yīng)答請求并運(yùn)行網(wǎng)關(guān)的服務(wù)器軟件的名稱和版本
Request.ServerVariables("All_Http")
客戶端發(fā)送的所有
HTTP
標(biāo)頭,前綴
HTTP_
Request.ServerVariables("All_Raw")
客戶端發(fā)送的所有
HTTP
標(biāo)頭
,
其結(jié)果和客戶端發(fā)送時一樣,沒有前綴
HTTP_
Request.ServerVariables("Appl_MD_Path")
應(yīng)用程序的元數(shù)據(jù)庫路徑
Request.ServerVariables("Content_Length")
客戶端發(fā)出內(nèi)容的長度
Request.ServerVariables("Https")
如果請求穿過安全通道(
SSL
),則返回
ON
如果請求來自非安全通道,則返回
OFF
Request.ServerVariables("Instance_ID")
IIS
實例的
ID
號
Request.ServerVariables("Instance_Meta_Path")
響應(yīng)請求的
IIS
實例的元數(shù)據(jù)庫路徑
Request.ServerVariables("Http_Accept_Encoding")
返回內(nèi)容如:
gzip,deflate
Request.ServerVariables("Http_Accept_Language")
返回內(nèi)容如:
en-us
Request.ServerVariables("Http_Connection")
返回內(nèi)容:
Keep-Alive
Request.ServerVariables("Http_Cookie")
返回內(nèi)容如:
nVisiT%
2DYum=125;ASPSESSIONIDCARTQTRA=FDOBFFABJGOECBBKHKGP
FIJI;ASPSESSIONIDCAQQTSRB=LKJJPLABABILLPCOGJGAMKAM;ASP
SESSIONIDACRRSSRA=DK
HHHFBBJOJCCONPPHLKGHPB
Request.ServerVariables("Http_User_Agent")
返回內(nèi)容:
Mozilla/4.0(compatible;MSIE6.0;WindowsNT5.1;SV1)
Request.ServerVariables("Https_Keysize")
安全套接字層連接關(guān)鍵字的位數(shù),如
128
Request.ServerVariables("Https_Secretkeysize")
服務(wù)器驗證私人關(guān)鍵字的位數(shù)如
1024
Request.ServerVariables("Https_Server_Issuer")
服務(wù)器證書的發(fā)行者字段
Request.ServerVariables("Https_Server_Subject")
服務(wù)器證書的主題字段
Request.ServerVariables("Auth_Password")
當(dāng)使用基本驗證模式時,客戶在密碼對話框中輸入的密碼
Request.ServerVariables("Auth_Type")
是用戶訪問受保護(hù)的腳本時,服務(wù)器用於檢驗用戶的驗證方法
Request.ServerVariables("Auth_User")
代證的用戶名
Request.ServerVariables("Cert_Cookie")
唯一的客戶證書
ID
號
Request.ServerVariables("Cert_Flag")
客戶證書標(biāo)誌,如有客戶端證書,則
bit0
為
0
如果客戶端證書驗證無效,
bit1
被設(shè)置為
1
Request.ServerVariables("Cert_Issuer")
用戶證書中的發(fā)行者字段
Request.ServerVariables("Cert_Keysize")
安全套接字層連接關(guān)鍵字的位數(shù),如
128
Request.ServerVariables("Cert_Secretkeysize")
服務(wù)器驗證私人關(guān)鍵字的位數(shù)如
1024
Request.ServerVariables("Cert_Serialnumber")
客戶證書的序列號字段
Request.ServerVariables("Cert_Server_Issuer")
服務(wù)器證書的發(fā)行者字段
Request.ServerVariables("Cert_Server_Subject")
服務(wù)器證書的主題字段
Request.ServerVariables("Cert_Subject")
客戶端證書的主題字段
Request.ServerVa