I am listing port 80 manually using HttpListener on windows forms .net 4.0 framework.
So when i get the content i get the following text on one of the parameters."%5B0%2C1%2C6%5D" The request is coming from ios device.
System.Net.WebUtility.HtmlDecode("%5B0%2C1%2C6%5D")
fails to decode.
decode should return "[0,1,6]"
http://www.url-encode-decode.com/ can decode it. If i use iis and .net 4.0 that can decode it too.
any suggestions?
You want to UrlDecode
, not HtmlDecode
.
"%xx" are hexadecimal-encoded ASCII values, as per this document: http://www.w3.org/International/O-URL-code.html used to encode reserved or extended characters within URIs.
"HTML encoding" (or generally, SGML Entities) begin with an ampersand character, e.g. &
or <
.`
BTW, if you want to perform URL decoding/encoding or HTML decoding/encoding from a client application (e.g. WinForms or WPF) don't use System.Web.*
because the System.Web.dll
is not necessarily available on every system because of the .NET Client Profile (though this only applies up-to .NET 4.0, .NET 4.5 and later all come with System.Web.dll
, see here: http://msdn.microsoft.com/en-us/library/cc656912(v=vs.110).aspx )