从ASP要求3.0经典参数检索 [英] Retrieving parameters from request ASP Classic 3.0
问题描述
有检索请求参数如下之间的问题或分歧:
Is there a problem or difference between retrieving the request parameter as follows:
Request("<ParamName>")
而不是:
的Request.Form(&LT;&PARAMNAME GT;)
或结果的Request.QueryString(&LT;&PARAMNAME GT;)?
在此先感谢!
推荐答案
的Request.Form()将得到张贴值。的Request.QueryString()将包含从查询字符串值。申请()将包含张贴价值,除非有相同名称的查询字符串值,在这种情况下,将包含查询字符串值。
Request.Form() will get values that are POSTed. Request.QueryString() will contain values from the query string. Request() will contain the POSTed value, unless there is a QueryString value for the same name, in which case it will contain the QueryString value.
我觉得Cookie可以也参与,但我的记忆是他们如何融入堆栈有点云里雾里。
I think cookies can be involved too, but my memory is a bit foggy on how they fit into the stack.
如果你关心从提交的表单来的值,然后使用的Request.Form(),如果你在乎一个URL查询字符串值,然后使用的Request.QueryString()。如果你不关心,只是使用要求()。
If you care about the value coming from a POSTed form, then use Request.Form(), if you care about a URL querystring value then use Request.QueryString(). If you don't care, just use 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 %>
这篇关于从ASP要求3.0经典参数检索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!