简体   繁体   中英

I need help figuring out what _HttpContext.QueryString() does

I can't understand what some of my code is doing exactly. Here's what I have:

model.People = _PersonProvider.GetListByIds(_HttpContext.QueryString()["people"])

I know that the model.People = (_HttpContext.QueryString()["people"] is supposed to return a list of id's but I'm having trouble knowing how it's doing that. Is this doing some kind of webservice call maybe? Something to do with the URL? I'm new to asp.net.

I am bit confused with the syntex you are using. As far as I know querystring variables are fetched as

HttpContext.Current.Request.QueryString["XYZ"]

This returns the value of variable from the querystring of current page. Say the URL you used to access a page is:

http://myURL.com?XYZ=Value1&ABC=Value2

then

HttpContext.Current.Request.QueryString["XYZ"] will return Value1 and 
HttpContext.Current.Request.QueryString["ABC"] will return Value2

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