循环遍历 VB.NET 中的 request.querystring [英] Looping through a request.querystring in VB.NET
本文介绍了循环遍历 VB.NET 中的 request.querystring的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试遍历查询字符串并提取某些值,如下所示:
I am trying to loop through a query string and pull out certain values as in:
?ProductID=1234&ProductID=4321&Quantity=1
对于 ProductID 旁边的每个值,我想执行一些逻辑.但我不确定如何获得这些值.有什么想法吗?
For each value next to ProductID I want to execute some logic. But I am not sure how to get to the values. Any ideas?
推荐答案
当您的查询字符串具有多个具有相同键的值时,您可以使用 NameValueCollection.GetValues 返回字符串数组的方法:
When your query string has more than one value with the same key you can use the NameValueCollection.GetValues method which returns a string array:
dim productID as string
for each productID in Page.Request.QueryString.GetValues("ProductID")
' do something with productID
next productID
这篇关于循环遍历 VB.NET 中的 request.querystring的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文