I have a webservice that returns data from a database.
Our services (the clients) have been blowing up because of illegal
character problems. Is there anything I can do on the server side to
work around this problem. I'm OK with deleting all the "bad"
characters.
I have a couple DTOs that are marked with [Serializable()] that I
return from the web service after they're populated with data from the
database. Is there some kind of attribute or "easy" way to stip out
illegal characters?
What is weird to me, is that the XmlSerializer serializes it just fine,
the clients are the ones blowing up. Here is the error I'm getting:
---------------------------------
System.InvalidOperationException: There is an error in XML document
(230, 966838). ---System.Xml.XmlException: '', hexadecimal value
0x04, is an invalid character. Line 230, position 966862.
at System.Xml.XmlScanner.ScanHexEntity()
at System.Xml.XmlTextReader.ParseBeginTagExpandCharEn tities()
at System.Xml.XmlTextReader.Read()
at System.Xml.XmlReader.ReadElementString()
at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationReader1.Read11
_EVariable(Boolean isNullable, Boolean checkType) at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationReader1.Read9_
EmailSpec(Boolean isNullable, Boolean checkType) at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationReader1.Read8_
EmailInfo(Boolean isNullable, Boolean checkType) at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationReader1.Read2_
CRobe(Boolean isNullable, Boolean checkType) at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationReader1.Read28
_CRobeGetForGuidResponse()
--- End of inner exception stack trace ---
I do populate the object properties by looping through each DataRow in
a DataSet and accessing the dr[column]. Is there a function that will
stip out "illegal" characters?
Any help would be greatly appreciated.