我正在将一个页面的参数传递给另一个页面,所有这些都是同名的......我如何看待它们?
dim sHtmlBody
sHtmlBody = ""
for i=0 to Request.QueryString("name").Count
sHtmlBody = "<html><body onload=""window.print();"">"
sHtmlBody = sHtmlBody & "<body>hello</body>"
sHtmlBody = sHtmlBody & "</head>"
next
context.Response.Write(sHtmlBody)
这就是我正在做的事情并且它有效。但是我如何访问个人姓名
Dim Name = Request.QueryString("Name")(i)
不起作用
答案 0 :(得分:1)
您可以尝试以下操作。
dim sHtmlBody
sHtmlBody = ""
Dim nameValues As String = Request.Form.GetValues("name")
For Each name As var In nameValues
sHtmlBody = "<html><body onload=""window.print();"">"
sHtmlBody = sHtmlBody & "<body>hello</body>"
sHtmlBody = sHtmlBody & "</head>"
Next
这意味着您可以执行以下操作。
Dim name = Request.Form.GetValues("name")(1)
答案 1 :(得分:0)
假设请求如下所示:SomePage.aspx?name=name1&name=name2&name=name3
您可以用逗号分隔Name
请求参数:
Dim names = Request.QueryString("Name").Split(",")
For Each name As String In names
' do something with each name
Next