473,805 Members | 2,119 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.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 20947
Have you tried simply calling URLEncode on the value?

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Rasmus" <Ra****@newsgro up.nospamwrote in message
news:B4******** *************** ***********@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 #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****@newsgro up.nospamwrote in message
news:B4******** *************** ***********@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 #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.Url Encode("c+KAnMO fxZLDqhd2w4DCtM Omwr8hawkCdsK9Y H7igqwITuKAmcOh XAcDxbjFoR3Cum/DqwFJRU7DpzbigJ lYZD1cJcKBwqgaB sObw6VxMMW9wrTD pD7CpSTDkeKAuuK AlFfDt8W+Jz3Cvh M7w5HCjeKAneKAu T3Dn8WTw5zigKEr w6QFxaF+wrvDksO kwqjDq1fCrsOewr c="));
and then I echo out the querystring and all's good..

Karl
--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Rasmus" <Ra****@newsgro up.nospamwrote in message
news:7F******** *************** ***********@mic rosoft.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****@newsgro up.nospamwrote in message
news:B4******* *************** ************@mi crosoft.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 #4
ok, but what happens when you after the sumbit do:

string test = Request.QuerySt ring["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.Url Encode("c+KAnMO fxZLDqhd2w4DCtM Omwr8hawkCdsK9Y H7igqwITuKAmcOh XAcDxbjFoR3Cum/DqwFJRU7DpzbigJ lYZD1cJcKBwqgaB sObw6VxMMW9wrTD pD7CpSTDkeKAuuK AlFfDt8W+Jz3Cvh M7w5HCjeKAneKAu T3Dn8WTw5zigKEr w6QFxaF+wrvDksO kwqjDq1fCrsOewr c="));
and then I echo out the querystring and all's good..

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

karl

"Rasmus" <Ra****@newsgro up.nospamwrote in message
news:D3******** *************** ***********@mic rosoft.com...
ok, but what happens when you after the sumbit do:

string test = Request.QuerySt ring["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.Ur lEncode("c+KAnM OfxZLDqhd2w4DCt MOmwr8hawkCdsK9 YH7igqwITuKAmcO hXAcDxbjFoR3Cum/DqwFJRU7DpzbigJ lYZD1cJcKBwqgaB sObw6VxMMW9wrTD pD7CpSTDkeKAuuK AlFfDt8W+Jz3Cvh M7w5HCjeKAneKAu T3Dn8WTw5zigKEr w6QFxaF+wrvDksO kwqjDq1fCrsOewr c="));
and then I echo out the querystring and all's good..

Karl
--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Rasmus" <Ra****@newsgro up.nospamwrote in message
news:7F******* *************** ************@mi crosoft.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****@newsgro up.nospamwrote in message
news:B4******* *************** ************@mi crosoft.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 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3235
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: /9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAUDBAQEAwUEBAQFBQUG etc.... I've been through the form I built over and over: string PostData = ""; PostData += "-----------------------------7d41fb3081216"; PostData += "\r"; PostData += "\n";
2
17141
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 files through email. I only need this to finish my app. Thank you!!! -------------------------------- From: marcelo szwarc ----------------------- Posted by a user from .NET 247 (http://www.dotnet247.com/)
2
20692
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 of 20 bytes length can I expect that I get the base64 string with the same length every time when I do that? And what will be the maximum length of this string? What's the schema is taken for this conversion? If we use UUENCODE or something else...
5
4854
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 contains a (1) content type one one line, a (2) filename, and (3) the encoding type (seems to always be Base64, followed by the encoded string. A process will be to read the content type and filename, then create a new binary file and write out the...
3
4102
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 what I did wrong here? Thanks.
7
7983
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 image are perfect before submission. This involves converting any uploaded image to a Base64 String and holding that in a hidden form field until either the post gets submitted to the database or the image gets replaced with another one. I...
5
4963
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...
10
7272
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 other location at the same time.. i successfully created the applictaion .. using some serialization concept (BInary Formatter).. But the main issue is that .. it isworking very slow. it take too much time around 30 - 40 sec to display image on the...
5
4238
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 split on in the HTTP header but when I attempt the following code it doesnt work. If anybody has some suggestions on what I should attempt here I would greatly appreciate it. 'boundary to split on Dim boundary as string = _ "boundarystring" ...
0
9596
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
10613
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10363
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
10368
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
9186
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
7649
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
5544
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...
1
4327
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
3
3008
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.