Is there a problem or difference between retrieving the request parameter as follows:
Request("<ParamName>")
Instead of:
Request.Form("<ParamName>")
or
Request.QueryString("<ParamName>")
?
Thanks in advance!
Is there a problem or difference between retrieving the request parameter as follows:
Request("<ParamName>")
Instead of:
Request.Form("<ParamName>")
or
Request.QueryString("<ParamName>")
?
Thanks in advance!
Request.Form() 将获得已发布的值。Request.QueryString() 将包含来自查询字符串的值。Request() 将包含 POSTed 值,除非存在同名的 QueryString 值,在这种情况下它将包含 QueryString 值。
我认为 cookie 也可以参与其中,但我对它们如何放入堆栈的记忆有点模糊。
如果您关心来自 POSTed 表单的值,则使用 Request.Form(),如果您关心 URL 查询字符串值,则使用 Request.QueryString()。如果您不在乎,只需使用 Request()。
快速样品测试:
<% OPTION EXPLICIT %>
<%
dim vname : vname = "test"
dim r : r = request(vname)
dim r_f : r_f = request.form(vname)
dim r_q : r_q = request.querystring(vname)
%>
POST:<br />
<form method="post">
<input type="text" name="test" value="Posted Form Value">
<input type="submit" name = "">
</form>
<hr>
<a href='?test=<% = Server.HtmlEncode("Querystring in URL") %>'>GET</a>
<hr>
request: <% = r %>
<hr>
request.form: <% = r_f %>
<hr>
request.querystring: <% = r_q %>