Tutorial :Any gotchas with Request.Params [ASP.NET]



Question:

Hopefully the answer is no, but are there any problems with using Request.Params instead of Request.QueryString for retrieving data in the query string in asp.net?


Solution:1

Not a gotcha as such, but just be aware that request.querystring is much lighter - request.params returns cookies, form variables, server variables and the querystring whereas request.querystring of course just returns the querystring value.


Solution:2

No, unless you happen to have Forms collection fields with the same field name as an argument name in the Query collection -- then you will get an array when you only expected a single key/value pair.


Solution:3

Already answered in When do Request.Params and Request.Form differ?

It talks about request.form but it is the same for request.querystring


Solution:4

No gotchas. Request.Params is just a bit more full featured.

Now, if you were serializing and saving it to the database, it would be wasteful of bytes, but thats about it.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »