Solved

url decode

Posted on 2010-08-13
7
401 Views
Last Modified: 2012-05-10
Hi,

How can I decode url using vb.net or c# or asp.net, the example is as below:


encoded:
http://en.wikipedia.org/wiki/simple:car

Decoded by browser:
http://simple.wikipedia.org/wiki/Car
Other scenario are characters like %6C in url.

I need clean url so I can use with DownloadString of webClient to scrape data.

Thank you
0
Comment
Question by:mkk39
7 Comments
 
LVL 35

Expert Comment

by:mrichmon
ID: 33432816
Well basic decoding is done via the HttpServerUtility.UrlDecode method


http://msdn.microsoft.com/en-us/library/6196h3wt.aspx

But that doesn't handle the URL conversion that wikipedia is doing....
0
 

Author Comment

by:mkk39
ID: 33432848
Thanks for reply

I already tried it but it is not working with example I have shown, please help me to solve issue with my example too

Thank you
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 33432860
Your example is not encoded therefore cannot be decoded.  It is being converted by wikipedia.
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:mkk39
ID: 33432874
So, how can I handle it to use with DownloadString ? or any other solution?
0
 

Author Comment

by:mkk39
ID: 33433111
Is there any other trick used by wiki, like here in example usage of colon. Can u please tell me if there are others too

Thank you
0
 
LVL 2

Expert Comment

by:Algol36
ID: 33436357
WebClient wc = new WebClient();
            wc.Headers.Add("User-Agent: Mozilla/4.0 (compatible; MSIE 8.0)");
            string s = wc.DownloadString("http://en.wikipedia.org/wiki/simple:car");
0
 
LVL 5

Accepted Solution

by:
sindhuxyz earned 500 total points
ID: 33520737
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video discusses moving either the default database or any database to a new volume.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now