简体   繁体   中英

WCF Service To Strip out WhiteSpaces and NewLines

Can any one please help me how to strip out WhiteSpaces and NewLines from SOAP Messages received to WCF Service.

Also

Is there any helper class to remove newlines and whitespaces before the object is deserialize and also after serialize

Because of whitespaces and Linefeeds (WCF is adding, i think after the deserialize) is giving me problems to verify custom signature string within my soap message.

Please help

Use this to strip lines that only contain whitespace:

Regex.Replace(subjectString, @"^\s+$[\r\n]*", "", RegexOptions.Multiline);

Also you can try this:

Regex.Replace(subjectString, @"^\r?\n?$", "", RegexOptions.Multiline);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM