有没有办法将所有的querystring名/值对放入一个集合? [英] Is there a way to get all the querystring name/value pairs into a collection?
本文介绍了有没有办法将所有的querystring名/值对放入一个集合?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有一种方法可以将所有的querystring名称/值对集合到一个集合中?
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.
推荐答案
可以,使用 HttpRequest.QueryString
集合:
Yes, use the HttpRequest.QueryString
collection:
获取HTTP查询字符串变量的集合。
Gets the collection of HTTP query string variables.
使用它像这样:
foreach (String key in Request.QueryString.AllKeys)
{
Response.Write("Key: " + key + " Value: " + Request.QueryString[key]);
}
这篇关于有没有办法将所有的querystring名/值对放入一个集合?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文