Closed dbuzz111 closed 4 years ago
Hi @dbuzz111 thanks for reaching out. Have you tried interacting with HttpContext.Request.QuerystringEntries
? It's a Dictionary<string, string>
and should give you what you need, if you're after req1
, req2
, etc (and their associated values).
Let me know!
Thank you, I didn't not see that method exposed! I think that is going to work perfect, and it seems it even works with this strange API where they do ?req=Value1&req=Value2&req=Value3.
Awesome :) Let me know how it works out for you.
So you're aware, if someone overloads querystring keys, i.e. req1=val1&req1=val2&req1=val3
, you'll see a KeyValuePair<string,string>
with key req1
and value of val1,val2,val3
. Since dictionaries don't allow duplicate key names, and some apps overload keys in the querystring, I opted to append values in a CSV format.
Please re-open if any further issues! Cheers, Joel
Hello Joel,
I'm trying to parse multiple GET requests for an API, eg GET /api/params.cgi?req1=Brand&req2=Label&req3=Name&req4=Description
I've reviewed the other issues and you suggested req.ToString() to parse, but I wonder if that may have changed in some of the recent updates.
Is this still what you recommended or is there a better way that I can process multiple get values in a single request?
Thank you for you help