This is really weird - I've got a MVC app running, including a Login
method in my ServicesController
class:
public ActionResult Login() {
var p = Request.Params;
var userName = p["username"];
var password = p["password"];
// etc...
}
The weird thing is that when I call the service with t开发者_StackOverflow社区he request:
/services/login?username=myusername&password=password
I get into the code and find that userName
is "anotherusername,myusername". Depending on what browser I'm using, I get different values in place of "anotherusername", which I recognize from some other apps I'm developing. So is "username" some kind of reserved word that one shouldn't use as a parameter name? What other reserved words are there that cannot be used safely as parameters?
Request.Params
combines values from Request.QueryString
, Request.Form
, Request.ServerVariables
and Request.Cookies
. I would expect that the second value is either a server variable or a cookie. You could find out by checking each collection for your request.
Try checking the Request.QueryString
(GET request) or Request.Form
(POST request) instead.
精彩评论