这两个在VBScript中有什么区别?
Request("startDate") Request.QueryString["startDate"]
请求(“startDate”)在哪里记录?我在这里看不到这个用法:
解决方法
ASP经典中的Request对象的官方文档如下:
http://msdn.microsoft.com/en-us/library/ms524948%28VS.90%29.aspx
引用这个问题的相关部分:
All variables can be accessed directly by calling Request(variable)
without the collection name. In this case,the Web server searches the
collections in the following order:
- QueryString
- Form
- Cookies
- ClientCertificate
- ServerVariables
If a variable with the same name exists in more than one collection,
the Request object returns the first instance that the object
encounters.
编辑:AnthonyWJones对这个问题做了一个很好的评论:避免使用Request(“name”)语法.事实上,这在上面的文档链接中提到:
It is strongly recommended that when referring to members of a
collection the full name be used. For example,rather than
Request.(“AUTH_USER”) use Request.ServerVariables(“AUTH_USER”). This allows the server to locate the item more quickly.