QueryString malformed after URLDecode

后端 未结 11 1456
太阳男子
太阳男子 2020-12-09 11:25

I\'m trying to pass in a Base64 string into a C#.Net web application via the QueryString. When the string arrives the \"+\" (plus) sign is being replaced by a space. It appe

11条回答
  •  被撕碎了的回忆
    2020-12-09 11:42

    The suggested solution:

    Request.QueryString["VLTrap"].Replace(" ", "+");
    

    Should work just fine. As for your concern:

    I had though of this but my concern with it, and I should have mentioned this to start, is that I don't know what other characters might be malformed in addition to the plus sign.

    This is easy to alleviate by reading about base64. The only non alphanumeric characters that are legal in modern base64 are "/", "+" and "=" (which is only used for padding).

    Of those, "+" is the only one that has special meaning as an escaped representation in URLs. While the other two have special meaning in URLs (path delimiter and query string separator), they shouldn't pose a problem.

    So I think you should be OK.

提交回复
热议问题