In an ASP.NET MVC3 application I have a function that looks like:
Public Sub DoSomething(controllerCtx As ControllerContext)
....
' Which to use? and Why?
Dim val = controllerCtx.HttpContext.Request.Params.Item("someKey")
Dim val = controllerCtx.HttpContext.Request.Item("someKey")
....
End Sub
(I'm aware that Item
is a Default
property in both and can be removed, that's not relevant in this question.)
Looking at the MSDN pages for Request.Item
and Params.Item
, I'm not seeing any differences. Both pages say they get values from: Cookies, Form, QueryString, or ServerVariables collections. (though they do list the orders differently.)
I've seen this Stack Overflow post, but it seems the answers focused on the QueryString
component moreso than the Request.Params.Item
vs Request.Item
.
Why would would I use one over the other? Is there any difference between the two at all?