473,667 Members | 2,650 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.ToBase6 4String() 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.QuerySt ring["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 4953
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.EscapeDataS tring() etc.

-- Barry

--
http://barrkel.blogspot.com/
Aug 28 '06 #4
just use server.urlencod e on the base 64 string

afaik request.queryst ring 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****@newsgro up.nospamschree f in bericht
news:48******** *************** ***********@mic rosoft.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.ToBase6 4String() 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.QuerySt ring["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****@newsgro up.nospamwrote
I've used the Convert.ToBase6 4String() 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
2561
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
537
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 this private string ConvertBase64ToString(string content) { StringBuilder sb = new StringBuilder(); int i = content.GetUpperBound(0);
4
5356
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 a decoded String. Any help is very much appreciated. Thanks Philip.
2
29310
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, but the instructions I received do not seem correct. I need to covert a hex string to base64 and was told to 1. convert from the HEX string to a byte array 2. convert the byte array to Base64 encoding 3. the two encodings would produce the...
0
3146
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 Base64) with the host's dpapi using the entropy value(without storing it as Base64), and then store the encrypted Aes key value and the entropy value in some SHARED VARIABLES AS BYTE ARRAYS(not Base64). I then decrypt the stored encrypted Aes...
5
4111
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. Cold somebody check this for me to see what I have done wrong: If you run this program and enter a path for a .GIF file into the white box and hit <Enter> it should display the string in the blue box. To test this if you click the menu File...
4
5530
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 converting the binary blocks to strings first, then converting the resulting string to base64. This seems highly inefficient and I'd like to just go straight from binary to a base64 string. Here is the conversion we're using from object to...
5
20941
by: Rasmus | last post by:
In a asp.net site i need to make a url link like this: http://server.com/test.aspx?base64=c+KAnMOfxZLDqhd2w4DCtMOmwr8hawkCdsK9YH7igqwITuKAmcOhXAcDxbjFoR3Cum/DqwFJRU7DpzbigJlYZD1cJcKBwqgaBsObw6VxMMW9wrTDpD7CpSTDkeKAuuKAlFfDt8W+Jz3CvhM7w5HCjeKAneKAuT3Dn8WTw5zigKErw6QFxaF+wrvDksOkwqjDq1fCrsOewrc= 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...
13
14766
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 send me the library file which helps that is really grateful. aruna.
0
8367
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8790
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8570
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8650
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7391
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6206
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4202
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2781
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 we have to send another system

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.