how to decode string in c#
i got the url from user by encodeURICompo开发者_如何学Cnent() in javascript. the url goes something like
"http%3A%2F%2Fgoogle.com"
how i can decode them
HttpUtility.UrlDecode() is the way to go. You find the documentation here: http://msdn.microsoft.com/en-us/library/system.web.httputility.urldecode.aspx
You could use the Server.UrlDecode() method.
http://msdn.microsoft.com/en-us/library/6196h3wt.aspx
From the docs:
String DecodedString = Server.UrlDecode(EncodedString);
Server.URLDecode( ). I'm assuming you're talking about ASP.net here - you didn't say.
ASP.Net right?
string Url = Server.UrlDecode("http%3A%2F%2Fgoogle.com");
You can use the following method to decode URLs:
System.Web.HttpUtility.UrlDecode
精彩评论