i have a URL like http%3A%2F%2Fwww%2Ewikimoveis%2Ecom%2Ebr%2Ffotos%2F1292%2FKO2551%2FDSC01366%2EJPG
I need to get it decode correctly. I believe that is Hexadecimal. Can't find any C# code that would do that.
th开发者_如何学Cank you
From C# URLDecode turns %5C into \\\\ instead of \
using System;
using System.Web;
string url = "http%3A2F%2Fwww%2Ewikimoveis%2Ecom%2Ebr%2Ffotos%2F1292%2FKO2551%2FDSC01366%2EJPG"
string decoded = HttpUtility.UrlDecode(url);
Outside of a web application, this is a way:
using System;
using System.Net;
namespace urldecoder
{
internal class Program
{
static void Main(string[] args)
{
String EncodedString = "http%3A%2F%2Fwww%2Ewikimoveis%2Ecom%2Ebr%2Ffotos%2F1292%2FKO2551%2FDSC01366%2EJPG";
String DecodedString = WebUtility.UrlDecode(EncodedString);
Console.WriteLine(DecodedString);
Console.ReadLine();
}
}
}
See: system-net-webutility-urldecode(system-string)
精彩评论