开发者

Splitting a query string?

this may seem l开发者_运维问答ike a stupid question but I have a query string which passes a unique id across pages, What I am wondering is how I would split the following so that I have just the id?

property-buildings_e1.aspx?SubPage=561

Many Thanks!


Request.QueryString("SubPage")


int subPage = 0;
if(Request.QueryString["SubPage"] != null)
    subPage = Convert.ToInt32(Request.QueryString["SubPage"]);


If you want to get the value of SubPage

Request.Params["SubPage"]

or

Request.QueryString["SubPage"]


You can use

HttpUtility.ParseQueryString.

NameValueCollection parts = HttpUtility.ParseQueryString(query);
string subPage = parts["SubPage"];


You should be able to access it using

Request.Querystring("SubPage")
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜