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.

How to make 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
Have you tried simply calling URLEncode on the value?

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Rasmus" <Ra****@newsgroup.nospamwrote in message
news:B4**********************************@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 #2

P: n/a
Yes, with no luck.

/Rasmus


"Karl Seguin [MVP]" wrote:
Have you tried simply calling URLEncode on the value?

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Rasmus" <Ra****@newsgroup.nospamwrote in message
news:B4**********************************@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 #3

P: n/a
I did some quick tests and it seems to work.

<a id="x" runat="server">test</a>

x.HRef = string.Format("tmp2.aspx?x={0}",
HttpUtility.UrlEncode("c+KAnMOfxZLDqhd2w4DCtMOmwr8 hawkCdsK9YH7igqwITuKAmcOhXAcDxbjFoR3Cum/DqwFJRU7DpzbigJlYZD1cJcKBwqgaBsObw6VxMMW9wrTDpD7Cp STDkeKAuuKAlFfDt8W+Jz3CvhM7w5HCjeKAneKAuT3Dn8WTw5z igKErw6QFxaF+wrvDksOkwqjDq1fCrsOewrc="));
and then I echo out the querystring and all's good..

Karl
--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Rasmus" <Ra****@newsgroup.nospamwrote in message
news:7F**********************************@microsof t.com...
Yes, with no luck.

/Rasmus


"Karl Seguin [MVP]" wrote:
>Have you tried simply calling URLEncode on the value?

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Rasmus" <Ra****@newsgroup.nospamwrote in message
news:B4**********************************@microso ft.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 #4

P: n/a
ok, but what happens when you after the sumbit do:

string test = Request.QueryString["x"];

/rasmus

"Karl Seguin [MVP]" wrote:
I did some quick tests and it seems to work.

<a id="x" runat="server">test</a>

x.HRef = string.Format("tmp2.aspx?x={0}",
HttpUtility.UrlEncode("c+KAnMOfxZLDqhd2w4DCtMOmwr8 hawkCdsK9YH7igqwITuKAmcOhXAcDxbjFoR3Cum/DqwFJRU7DpzbigJlYZD1cJcKBwqgaBsObw6VxMMW9wrTDpD7Cp STDkeKAuuKAlFfDt8W+Jz3CvhM7w5HCjeKAneKAuT3Dn8WTw5z igKErw6QFxaF+wrvDksOkwqjDq1fCrsOewrc="));
and then I echo out the querystring and all's good..

Karl
--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Rasmus" <Ra****@newsgroup.nospamwrote in message
news:7F**********************************@microsof t.com...
Yes, with no luck.

/Rasmus


"Karl Seguin [MVP]" wrote:
Have you tried simply calling URLEncode on the value?

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Rasmus" <Ra****@newsgroup.nospamwrote in message
news:B4**********************************@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
it worked for me...

karl

"Rasmus" <Ra****@newsgroup.nospamwrote in message
news:D3**********************************@microsof t.com...
ok, but what happens when you after the sumbit do:

string test = Request.QueryString["x"];

/rasmus

"Karl Seguin [MVP]" wrote:
>I did some quick tests and it seems to work.

<a id="x" runat="server">test</a>

x.HRef = string.Format("tmp2.aspx?x={0}",
HttpUtility.UrlEncode("c+KAnMOfxZLDqhd2w4DCtMOmwr 8hawkCdsK9YH7igqwITuKAmcOhXAcDxbjFoR3Cum/DqwFJRU7DpzbigJlYZD1cJcKBwqgaBsObw6VxMMW9wrTDpD7Cp STDkeKAuuKAlFfDt8W+Jz3CvhM7w5HCjeKAneKAuT3Dn8WTw5z igKErw6QFxaF+wrvDksOkwqjDq1fCrsOewrc="));
and then I echo out the querystring and all's good..

Karl
--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Rasmus" <Ra****@newsgroup.nospamwrote in message
news:7F**********************************@microso ft.com...
Yes, with no luck.

/Rasmus


"Karl Seguin [MVP]" wrote:

Have you tried simply calling URLEncode on the value?

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Rasmus" <Ra****@newsgroup.nospamwrote in message
news:B4**********************************@microso ft.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 #6

This discussion thread is closed

Replies have been disabled for this discussion.