简体   繁体   中英

C# get URL query string Request.QueryString not working

I have a URL like so api/getListItems?data=false

how would I get the query parameter data? I tried using Request.QueryString but I get an error 'The type or namespace name 'Request' could not be found' I have the System.Web referenced installed, the version is 4.0.0.0 and the .NET Framework is 4.5...is there something I am missing?

Thanks,

这就是我从querystrig读取数据的方式:

bool Data = Boolean.Parse(System.Web.HttpContext.Current.Request.QueryString["data"]);

you can also do this :

string url = HttpContext.Current.Request.Url.AbsoluteUri;

String data= url.Split('?')[1].Split('=')[1];

thanks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM