问题
I've looked all over, and I can't find a solution for this. Correction: I find solutions, but they (I can't make them) work.
I'm passing an array to an HttpHandler via the query string. I've read that you read it this way:
Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
Dim request As HttpRequest = context.Request
For u = 0 To request.QueryString("arrayIneed").Count - 1
selectPONumber.Add(request.QueryString("arrayIneed")(u))
Next
Doing this, regardless of whether the query string format is arrayIneed=data1,data2... or arrayIneed=[data1,data2...], chops everything after = into single values.
Please help. Many thanks in advance!
回答1:
request.QueryString("arrayIneed")
will just pull a string out if you need it as an array then you will need to split it into one
dim arr = Request.QueryString("arrayINeed").Split(",")
For Each s In arr
selectPoNumber.Add(s)
Next
worth noting that if your po number array is one of integers, you will have to convert s into an int
来源:https://stackoverflow.com/questions/13198250/pass-array-via-query-string-to-httphandler