开发者

read query stringfrom mvc url

This maybe a stupid question but i've come from an asp.net background so reading a querystring is pretty easy, not to sure how I should be doing it with mvc.

Lets say I have a url that looks like https://localhost/Account/Verify?code=3ae9a4f4-84d3-4686-b5a6-3e53e008537b

How do I read the code=3ae9a..开发者_如何转开发.........?


Request.QueryString["CODE"]

That's it :)


You can do it very simple.

string codeValue = "";
if(Request.QueryString["code"] != null)
{
    codevalue = Request.QueryString["code"]
}

And if you use Guid, like in this case, just create new Guid from value.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜