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
I had similar problem with a parameter that contains Base64 value and when it comes with '+'. Only Request.QueryString["VLTrap"].Replace(" ", "+"); worked fine for me; no UrlEncode or other encoding helping because even if you show encoded link on page yourself with '+' encoded as a '%2b' then it's browser that changes it to '+' at first when it showen and when you click it then browser changes it to empty space. So no way to control it as original poster says even if you show links yourself. The same thing with such links even in html emails.
If you use System.Uri.UnescapeDataString(yourString)
it will ignore the +
. This method should only be used in cases like yours where when the string was encoded using some sort of legacy approach either on the client or server.
See this blog post: http://blogs.msdn.com/b/yangxind/archive/2006/11/09/don-t-use-net-system-uri-unescapedatastring-in-url-decoding.aspx
I am by no means a C# developer but it looks like you need to url ENCODE your Base64 string before sending it as a url.
System.Web.HttpUtility.UrlEncode(yourString)
will do the trick.
As a quick hack you could replace space with plus character before base64-decoding.