url decode exception - c#
I have some URL encoded data in a db (sql server 2005) which I decode to parse it. I use:
Uri.UnescapeDataString
sometimes I get:
{"Invalid URI: The开发者_开发知识库re is an invalid sequence in the string."}
what invalid sequences do I have to look out for you reckon?
Thanks.
Christian
Have you tried using the HttpUtility.UrlDecode
method instead?
As for the "why", perhaps you were running into the .NET 4.0/4.5 issue listed here? Uri.UnescapeDataString fails on different computer
Try this instead.
string decodedUrl = Server.UrlDecode("your-url");
It may possible that your string contain HexEncoded Parameters.
Can you please provide sample string that cause this error.
Thanks, Jinal.
精彩评论