423,473 Members | 2,593 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,473 IT Pros & Developers. It's quick & easy.

Make a Base64 string Url Safe

P: n/a
In a asp.net site i need to make a url link like this:
http://server.com/test.aspx?base64=c...jDq1fCrsOewrc=

I've used the Convert.ToBase64String() to make the querystring parameter

But as you can see the second char is a "+". When receiving the parameter in
the test.aspx page this + gets replaced with an empty space " ".
On test.aspx i receive the parameter like this:

string test = Request.QueryString["base64"];
I've read there two articeles without finding a super nice way of making a
base64 string url safe

http://www.codeproject.com/aspnet/Sc...eryStrings.asp
http://www.codeproject.com/aspnet/EncodedUrlBuilder.asp
Aug 28 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Rasmus wrote:
In a asp.net site i need to make a url link like this:
I've read there two articeles without finding a super nice way of making a
base64 string url safe

http://www.codeproject.com/aspnet/Sc...eryStrings.asp
http://www.codeproject.com/aspnet/EncodedUrlBuilder.asp
Are you asking a question?

-- Barry

--
http://barrkel.blogspot.com/
Aug 28 '06 #2

P: n/a
Yes: "How do i make a Base64 string Url Safe?"
/Rasmus

"Barry Kelly" wrote:
Rasmus wrote:
In a asp.net site i need to make a url link like this:
I've read there two articeles without finding a super nice way of making a
base64 string url safe

http://www.codeproject.com/aspnet/Sc...eryStrings.asp
http://www.codeproject.com/aspnet/EncodedUrlBuilder.asp

Are you asking a question?

-- Barry

--
http://barrkel.blogspot.com/
Aug 28 '06 #3

P: n/a
Rasmus wrote:
Yes: "How do i make a Base64 string Url Safe?"
I'll tell you what I do: I don't use Base64. I use a hexadecimal
encoding, using only 0-9 and A-F. It's more verbose than Base64, but it
always works.

Alternatively, you can swap out the characters that don't work well in
URLs ('/' and '+') with URL encoding, i.e. '%XX' for the values for /
and + (%2F and %2B), or use URI.EscapeDataString() etc.

-- Barry

--
http://barrkel.blogspot.com/
Aug 28 '06 #4

P: n/a
just use server.urlencode on the base 64 string

afaik request.querystring automaticly performs a urldecode , however if it
isn`t use server .urldecode on the receiving part to get the base64 string
back
regards

Michel Posseth .


"Rasmus" <Ra****@newsgroup.nospamschreef in bericht
news:48**********************************@microsof t.com...
In a asp.net site i need to make a url link like this:
http://server.com/test.aspx?base64=c...jDq1fCrsOewrc=

I've used the Convert.ToBase64String() to make the querystring parameter

But as you can see the second char is a "+". When receiving the parameter
in
the test.aspx page this + gets replaced with an empty space " ".
On test.aspx i receive the parameter like this:

string test = Request.QueryString["base64"];
I've read there two articeles without finding a super nice way of making a
base64 string url safe

http://www.codeproject.com/aspnet/Sc...eryStrings.asp
http://www.codeproject.com/aspnet/EncodedUrlBuilder.asp

Aug 28 '06 #5

P: n/a
"Rasmus" <Ra****@newsgroup.nospamwrote
I've used the Convert.ToBase64String() to make the querystring parameter
Use "UrlEncode" to encode the URL prior to sending it back to the client.

--
Chris Mullins MCSD.NET, MCPD:Enterprise
http://www.coversant.net/blogs/cmullins
Aug 28 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.