Params & QueryString

R

rn5a

Assume that an ASPX page is accessed using the following URL:

http://myserver/Page1.aspx?fname=john

The value of the querystring fname (which is john) can be retrieved
using both Request.Params("fname") & Request.QueryString("fname").

So what's the difference between Request.Params("fname") &
Request.QueryString("fname")?
 
D

David Wier

From my understanding, Request.Params is kind of like the old way I've seen
in Classic ASP, using Request("fname")
Here the problem is that it will go through all the possible collections
until it finds what it needs (QueryString, Form, ServerVariables, and
Cookies items)
So - the most efficient way, when using Querystrings is
Request.Querystring("fname")
Also, if you have a (let's say) a querystring AND a cookie called "ID", and
just used Request.Params - - you will probably have problems. I haven't
tested this, but it would seem to be the case.
 
J

Joerg Jooss

Thus wrote (e-mail address removed),
Assume that an ASPX page is accessed using the following URL:

http://myserver/Page1.aspx?fname=john

The value of the querystring fname (which is john) can be retrieved
using both Request.Params("fname") & Request.QueryString("fname").

So what's the difference between Request.Params("fname") &
Request.QueryString("fname")?

Params "gets a combined collection of QueryString, Form, ServerVariables,
and Cookies items" (quoting MSDN).

Cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,071
Latest member
MetabolicSolutionsKeto

Latest Threads

Top