Solved

url decode

Posted on 2010-08-13
7
404 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

809 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