有没有办法让所有的查询字符串名称/值对到一个集合? [英] Is there a way to get all the querystring name/value pairs into a collection?

查看:141
本文介绍了有没有办法让所有的查询字符串名称/值对到一个集合?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法让所有的查询字符串名称/值对到一个集合?

Is there a way to get all the querystring name/value pairs into a collection?

我正在寻找一个内置在.NET的方式,如果不是我只能分割的&功放;并加载的集合。

I'm looking for a built in way in .net, if not I can just split on the & and load a collection.

推荐答案

是,使用<$c$c>Htt$p$pquest.QueryString系列:

Yes, use the HttpRequest.QueryString collection:

获取HTTP查询字符串变量的集合。

Gets the collection of HTTP query string variables.

您可以使用它是这样的:

You can use it like this:

foreach (String key in Request.QueryString.AllKeys)
{
    Response.Write("Key: " + key + " Value: " + Request.QueryString[key]);
}

这篇关于有没有办法让所有的查询字符串名称/值对到一个集合?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆