ASP.NET MVC - 获取查询字符串值 [英] ASP.NET MVC - Getting QueryString values
本文介绍了ASP.NET MVC - 获取查询字符串值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在ASP.NET MVC是你应该拿起查询字符串PARAMS您在ASP.NET的WebForms做同样的方式?还是在的[AcceptVerbs(HttpVerbs.Get)宣布获得以某种方式使用?
Under ASP.NET MVC are you supposed to pick up QueryString params the same way you do in ASP.NET WebForms? or does the [AcceptVerbs(HttpVerbs.Get)] declaration get used somehow?
推荐答案
查询字符串参数,可以简单地通过使用操作参数接受 - 即
Query string parameters can be accepted simply by using an argument on the action - i.e.
public ActionResult Foo(string someValue, int someOtherValue) {...}
将接受类似的查询... / someroute someValue中= ABC&放大器; someOtherValue = 123
which will accept a query like .../someroute?someValue=abc&someOtherValue=123
除此之外,你可以看一下要求直接进行更多的控制。
Other than that, you can look at the request directly for more control.
这篇关于ASP.NET MVC - 获取查询字符串值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文