c# - How to remove special characters in ASP.NET Web Service -
I have created a web service system in the espanet and receiving feedback in XML. There are too many special characters in response.
How to deal with these special characters, because I am getting such errors:
"CRLF characters are not valid in the specified value"
What method should I use? Is this a HTTPP suitable?
If so, is there a sample?
My code: I'm using Regex.Replace
, but I'm getting an error:
string link = "http : //xxx.xx.x "; HttpWebRequest Request = (HttpWebRequest) WebRequest.Create (link); Request.Connection = Regex.Replace (newstr.m12345 (str, name, pwd, id), "[^ \" a-zA-Z0-9 _?> Lt;> + = ./: -] ", "";); String connection = request.connection; return connection;
OK, I got the answer XDocument .
with the help of using string link = "http: //xxx.xx.x"; HttpWebRequest request = (HttpWebRequest) WebRequest .Create (link); XDocument Doc = XDocument.Parse (newstr.m12345 (str, name, pwd, id) string connection = convert.ToString (doc); return connection;
Comments
Post a Comment