473,509 Members | 4,901 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to make Base64 string url safe

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
5 20921
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3201
by: Magnus | last post by:
Hi, I'm programatically posting an image using multipart/form-data. It sends to the server OK, but when I try to view it in the browser, it is still in the base64 string I sent it as:...
2
17097
by: marcelo szwarc via .NET 247 | last post by:
I already broke my head, searched everywhere. PLEASE I NEED YOUR HELP! Do you know how can I convert an image file( like a gif or jpeg ) to a Base64 string? I need to use it to send embedded image...
2
20678
by: Dmitri Shvetsov | last post by:
Hi All, Does somebody know what's the length's ratio in we convert byte to base64 string? Is it a constant ratio or it can be different from case to case? For example if I convert a byte array...
5
4819
by: AC [MVP MCMS] | last post by:
Any pointers on how to (1) read a Base64 encoded string from a text file and (2) write it to a binary file? I have a ton of files that are being generated from a legacy system. Each file...
3
4089
by: Guoqi Zheng | last post by:
Dear sir, I need to decode base64 encoded email. I used below function but it does not work correctly, especially when I need to decode some Characters like Chinese, Can some one point out...
7
7857
by: Neo Geshel | last post by:
Greetings. I have managed to stitch together an awesome method of posting text along with an image to a database, in a way that allows an unlimited number of previews to ensure that text and...
5
4937
by: Rasmus | last post by:
In a asp.net site i need to make a url link like this:...
10
7247
by: sandeepdhankar10 | last post by:
hi!!! i need some help from the Experts Like u people.. i m creating a applictaion that transfer images to the webservice which store in server memory temp.. and retrive back those images on...
5
4218
by: smclellan86 | last post by:
Hi Everybody, I've been working on this challenge for a while now without much luck. What I'm attempting to do is split a MIME byte response into its individual images. I am given the boundary to...
0
7137
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7347
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7416
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7073
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7506
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4732
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3207
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1571
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
443
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.