开发者

Can I add a string converted to Base64 as part of a URL?

I have a string converted with encryption. I would like to make this part of a 开发者_开发技巧URL. Is that possible if it has been converted to base64 or do I need to do something more?

var going_to_be_part_of_url = System.Convert.ToBase64String(bytOut, 0, i);

Thanks


Yes, but it's not a good idea, Base64 requires that you respect the difference between upper case and lower case. URL's aren't typically case strict.

Then there's the problem of the special characters in Base64 being converted to URL encoded equivalents, making your URL's ugly and less manageable.

You should go with Base36 instead.


You can use a modified base 64 for URL Applications which is just base64 with a couple of the problem characters replaced.

The easiest way is to take your base64 string and encode perform a string replace on the problem characters when building the URL, and reversing the process when interpreting the URL.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜