Solved

url decode

Posted on 2010-08-13
7
406 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

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

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…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

729 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