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