Solved

url decode

Posted on 2010-08-13
7
402 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

910 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

23 Experts available now in Live!

Get 1:1 Help Now