473,406 Members | 2,439 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,406 software developers and data experts.

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

Similar topics

2
by: Karl Pech | last post by:
Hi all, I'm trying to write a program which can read in files in the following format: sos_encoded.txt: --- begin-base64 644 sos.txt UGxlYXNlLCBoZWxwIG1lIQ== ---
1
by: mvdevnull | last post by:
hey all currently i use the following piece of code to check if the string passed to me can be converted to base64, it is not very efficient and bad, can someone please suggest another of doing...
4
by: John | last post by:
Hi all, I've been going through google and yahoo looking for a certain base64 decoder in C without success. What I'm after is something that you can pass a base64 encoded string into and get back...
2
by: kevin | last post by:
DISCLAIMER: I know what the words mean (i.e. by definition), but I in know way pretend to understand the specifics of either, therefore I may need a basic primer before I can accomplish this task,...
0
by: Phil C. | last post by:
(Cross post from framework.aspnet.security) Hi. I testing some asp.net code that generates a 256 bit Aes Symmetric Key and a 256 bit entropy value. I encrypt the Aes key(without storing it as...
5
by: Jay | last post by:
I have bean trying to get my head around reading .GIF files from base64 strings, Basically I need to specify a filename and convert it to base64 then I can copy/past the string to wear I want it....
4
by: Russell Warren | last post by:
I've got a case where I want to convert binary blocks of data (various ctypes objects) to base64 strings. The conversion calls in the base64 module expect strings as input, so right now I'm...
5
by: Rasmus | last post by:
In a asp.net site i need to make a url link like this:...
13
by: aruna.eies.eng | last post by:
i am currently trying to convert data into binary data.for that i need to know how to achieve it in c language and what are the libraries that we can use. so if any one can send me a sample code or...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.