When you access the string or string value of a request from code in ASP.NET, what are the pros and cons of using, say:
string p = Request["param"];
instead:
string p = Request.QueryString["param"];
string p = Request.Form["param"];
I thought about it many times and came up with:
Shortcut:
- Shorter (more readable, easier for beginners to remember, etc.)
A long way:
- No problem if there is a form value and a query string value with the same name (although this is usually not a problem)
- Someone reading the code later knows whether to look in the URLs or form elements to find the data source (perhaps the most important point).
.
. What other advantages / disadvantages exist for each approach?