Ondřej
Ondřej

Reputation: 1673

HttpUtility.ParseQueryString is not working as intended

I need to get collection of HTTP query names and values. I am using this code:

Dim query = "https://api.worldoftanks.eu/wot/globalmap/clanbattles/?application_id=b72a008042b0afa92aa44bd9fc20f5d9&clan_id=500061064"
Dim nameValuePairs = HttpUtility.ParseQueryString(query)  

I am expecting to get (name:value):

application_id:b72a008042b0afa92aa44bd9fc20f5d9
clan_id:500061064

But I get:

https://api.worldoftanks.eu/wot/globalmap/clanbattles/?application_id:b72a008042b0afa92aa44bd9fc20f5d9
clan_id:500061064

Is this bug in .NET Framework 4.0?

Upvotes: 2

Views: 1453

Answers (1)

Ondřej
Ondřej

Reputation: 1673

I forgot that you must pass Query part, not whole Uri...

Dim nameValuePairs = HttpUtility.ParseQueryString(New Uri("https://api.worldoftanks.eu/wot/globalmap/clanbattles/?application_id=b72a008042b0afa92aa44bd9fc20f5d9&clan_id=500061064").Query)

Upvotes: 4

Related Questions