Decode XML returned by a webservice (< and > are replaced with < and >)? [duplicate]
Possible Duplicate:
How to decode string to XML string in C#
I'm calling a webservice which returns XML. If I'm using SOAP, all is fine, I get valid XML back. If however I use POST to get the return value, the XML arrives encoded as the content of the response.
This means, all < and > are replaced with <
and >
.
Is there a way to convert the string back into valid XML? I don't want to use a RegEx or to replace manually since I'm sure that there are a couple of other characters that have been encoded besides the < and >.
Framework is .NET 3.5
You can use HttpServerUtility.HtmlDecode(encodedString)
to return the decoded string.
Appropriate msdn link HtmlDecode
For some reason HttpServerUtility.HtmlDecode
is not exist for me.
Try HttpUtility.HtmlDecode
to solve this problem.
精彩评论