473,395 Members | 1,404 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,395 software developers and data experts.

URL Encoding Without using HttpServerUtil

I am a C# .Net developer who has been involved with the development of a framework library used within our company. The framework is being developed against .Net version 2.0. One question I have regarding .Net is the facility for URLEncoding of data. I am aware of the HttpServerUtil class. This class however is only really available to you when using ASP .Net. It doesn't seem to be possible to instantiate it outside of ASP. This is quite annoying given that the ability to URL Encode a string can be useful for applications other than just web sites. In Java URL Encoding and URL Decoding are available via a pair of utility classes in the java.net package. I wondered if .Net might have some equivalent to them. Whenever I search for information about URL Encoding in ,Net I just keep finding information about the HttpServerUtility class. Is there another way of URL encoding (besides having to write my own URL Encoding utility class)?
Aug 27 '08 #1
4 1798
balabaster
797 Expert 512MB
Is this what you're looking for? I think it does just about the same thing as the ServerEncode method found in the HttpServerUtility class.

Expand|Select|Wrap|Line Numbers
  1. Dim OutStr As String = System.Uri.EscapeDataString("Hello World This is my test String; with \ [ special * chars")
  2.  
Expand|Select|Wrap|Line Numbers
  1. string OutStr = System.Uri.EscapeDataString("Hello World This is my test String; with \ [ special * chars");
  2.  
Aug 27 '08 #2
balabaster
797 Expert 512MB
Thanks Plater... I obviously didn't read that closely enough before hitting submit
Aug 27 '08 #3
Thank you. That is usefull.

I am wondering now if there is also an equivalent to the HtmlEncode method somewhere else but I am going to have a look around and see what I can find.
Aug 28 '08 #4
Thank you. That is usefull.

I am wondering now if there is also an equivalent to the HtmlEncode method somewhere else but I am going to have a look around and see what I can find.
Never Mind. I found it is in the HttpUtility class as a static method.
Aug 28 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: wenmang | last post by:
Hi, I ma thinking whether to use Base64 encoding to encode the binary content in the XML file. I have done some simple calculations, it seems to me that the size for encoded content increases by...
1
by: Jon Maz | last post by:
Hi, I am working on a dotnet url rewriting mechanism that has to be able to deal with urls containing non-standard characters, eg http://www.mysite.com/Télécharger. The problem is that some...
10
by: Christopher H. Laco | last post by:
Long story longer. I need to get web user input into a backend system that a) only grocks single byte encoding, b) expectes the data transer to be 1 bytes = 1 character, and c) uses the HP Roman-6...
4
by: H Lee | last post by:
Hi, I'm an XML newbie, and not sure if this is the appropriate newsgroup to post my question, so feel free to suggest other newgroups where I should post this message if this is the case. I'm...
10
by: Mark Rae | last post by:
Hi, I'm in the process if converting the data out of an old DOS-based SunAccounts system (don't ask!) into SQL Server. The data has been sent to me as a collection of hundreds of SunAccounts...
7
by: EmeraldShield | last post by:
We have an application that uses UTF8 everywhere to load / save / process documents. One of our clients is having a problem with BIG Encoded files being trashed after running through our app. ...
37
by: Zhiv Kurilka | last post by:
Hi, I have a text file with following content: "((^)|(.* +))§§§§§§§§" if I read it with: k=System.IO.StreamReader( "file.txt",System.Text.Encoding.ASCII); k.readtotheend()
1
by: ujjwaltrivedi | last post by:
Hey guys, Can anyone tell me how to create a text file with Unicode Encoding. In am using FileStream Finalfile = new FileStream("finalfile.txt", FileMode.Append, FileAccess.Write); ...
10
by: amygdala | last post by:
Hi all, Another problem that has been bugging me for a while now, but which I swept under the rug too long too now is a mail encoding problem at my (shared) webhost. The problem is that on...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.