Risposte:
Server.UrlDecode(xxxxxxxx)
System.Web.HttpServerUtilityBase, ma questo dovrebbe già essere importato in ASP.NET MVC.
string decodedUrl = Uri.UnescapeDataString(url)
o
string decodedUrl = HttpUtility.UrlDecode(url)
L'URL non viene completamente decodificato con una chiamata. Per decodificare completamente è possibile chiamare uno di questi metodi in un ciclo:
private static string DecodeUrlString(string url) {
string newUrl;
while ((newUrl = Uri.UnescapeDataString(url)) != url)
url = newUrl;
return newUrl;
}
Uri.UnescapeDataStringdue volte e ho ottenuto quello che volevo !! : D
Hai provato HttpServerUtility.UrlDecodeo HttpUtility.UrlDecode?
HttpServerUtility.UrlDecodemetodo che è un'istanza si dovrebbe usare HttpContext.Current.Server.UrlDecode.
Provare:
var myUrl = "my.aspx?val=%2Fxyz2F";
var decodeUrl = System.Uri.UnescapeDataString(myUrl);