简体   繁体   English

我需要帮助弄清楚_HttpContext.QueryString()的作用

[英]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. 我知道model.People =(_HttpContext.QueryString()[“ people”]应该返回一个ID列表,但是我不知道它是如何执行的。这可能是某种Web服务调用吗?与URL有关吗?我是asp.net的新手。

I am bit confused with the syntex you are using. 我对您使用的Syntex感到困惑。 As far as I know querystring variables are fetched as 据我所知,querystring变量被提取为

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: 假设您用来访问页面的URL是:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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