[英]how to decode string in c#
我通過JavaScript中的encodeURIComponent()從用戶那里獲得了url。 網址類似
"http%3A%2F%2Fgoogle.com"
我如何解碼它們
HttpUtility.UrlDecode()是必經之路。 您可以在這里找到文檔: http : //msdn.microsoft.com/zh-cn/library/system.web.httputility.urldecode.aspx
您可以使用Server.UrlDecode()方法。
http://msdn.microsoft.com/en-us/library/6196h3wt.aspx
從文檔:
String DecodedString = Server.UrlDecode(EncodedString);
Server.URLDecode()。 我假設您在這里談論的是ASP.net-您沒有說。
您可以使用以下方法來解碼URL:
System.Web.HttpUtility.UrlDecode
ASP.Net對嗎?
string Url = Server.UrlDecode("http%3A%2F%2Fgoogle.com");
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.