Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想QueryString在非控制器类中获取
QueryString
string configType = Request.QueryString["configType"];
我应该使用什么命名空间?
using System.Web不工作
using System.Web
试试这个:
var valueOfT = System.Web.HttpContext.Current.Request.QueryString["t"];
但要有主动性HttpContext。
HttpContext
但我最好建议将值从您的控制器类传递给非控制器类。