A:
request.querystring 是用來(lái)接收地址里面?后面的xx=xx的內(nèi)容
而request.form 是用來(lái)接收表單遞交來(lái)的數(shù)據(jù)
不過(guò)我可以告訴你個(gè)兩全其美的方法
例如 request("offline")
就無(wú)論采用的是以上哪種方法的字段值都可以讀取了
B:
request.form是指用form遞交過(guò)來(lái)的數(shù)據(jù)。而request.querystring則是指用URL遞交過(guò)來(lái)的。你用的是login.asp?offline=true,這個(gè)當(dāng)然是URL遞交的啦。
C:
Request.Form和Request.QueryString兩個(gè)接收參數(shù)來(lái)源不同,前者是接收從表單Form來(lái)的參數(shù),后者是從URL來(lái)的參數(shù)。
你這有這一句logon.asp?offline=true這是URL的傳遞參數(shù)。
如果要用Request.Form()的話,那頁(yè)面至少得有個(gè)表單,比如:
<form name=form1 method=post action=logon.asp>
<input type=text name=user value="">
</form>
這樣在提交過(guò)表單后,就可以用Request.Form("user")得到這個(gè)文本框傳遞過(guò)來(lái)得數(shù)值。
D:
request.querystring和request.form的區(qū)別
request.querystring是用post方法讀取的 不安全
request.form是用get方法讀取的
form表單中的method中看你是get還是post
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>無(wú)標(biāo)題文檔</title>
</head>
<body>
<p>
<%
if request.querystring("offline")="true" then
session.Abandon()
response.Redirect("login1.htm")
end if
%>
歡迎進(jìn)入:<%=request.Form("user")%></p>
<p>當(dāng)前聯(lián)機(jī)人數(shù)為:</p><%=application("onlinenum")%>
<p><a href=login.asp?offline=true>離開(kāi)</a></p>
</body>
</html>
posted on 2009-10-16 14:12
becket_zheng 閱讀(736)
評(píng)論(1) 編輯 收藏 所屬分類(lèi):
web前端開(kāi)發(fā)