Reputation: 179
In a QueryString I have a part that looks like this
...u4w51EEcg8%2bj04e7C....
When I am using HttpUtility.UrlDecode the part "%2b" which represents a "+" just turns into a white space. I'm using HttpUtility.UrlEncode in the first place to encode the string.
Does anyone have any clue to what is going on?
Upvotes: 0
Views: 160
Reputation: 2122
Are you decoding twice? For convenience, a +
sign in a URL decodes to (space, 0x20). While
%2b
should decode to +
, decoding that will give you .
EDIT: Just saw your self-answer, and yeah, always check whether your getter functions / properties automatically decode for you. Double-decoding usually doesn't produce the desired result, and can even lead to security risks.
Upvotes: 1
Reputation: 179
It looks like that "Request.QueryString[]" decodewhatever it gets, so what happened was that I decode the QueryString 2 times, which makes "+" a whitespace.
Upvotes: 0