473,396 Members | 1,773 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 20918
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
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
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
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
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
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
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
by: Rasmus | last post by:
In a asp.net site i need to make a url link like this:...
10
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
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.