help.axcms.netAxinom Logo
Save Save Chapter Send Feedback
KB10009: ArgumentException: , hexadecimal value , is an invalid character
when calling WebQueryService


A code using WebQueryService (ie the Members overview) crashes with following exception:

Exception Information
System.Web.HttpUnhandledException: Exception of type
'System.Web.HttpUnhandledException' was thrown. --->
System.InvalidOperationException: Client found response content type
of 'text/html; charset=utf-8', but expected 'text/xml'.
The request failed with the error message:

Server Error in '/' Application.

' ', hexadecimal value 0x0C, is an invalid character.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: ' ', hexadecimal value 0x0C, is an invalid character.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[ArgumentException: '

', hexadecimal value 0x0C, is an invalid character.]
System.Xml.XmlConvert.VerifyCharData(String data, ExceptionType
exceptionType) +1867029
System.Xml.DocumentXmlWriter.WriteString(String text) +26
System.Xml.XmlWellFormedWriter.WriteString(String text) +84
text) +9
text) +9

Xml Writer writer, SoapException soapException, HttpStatusCode


Serializer used for web services serializes strings without any additional encoding, and since control characters are invalid in XML, it cannot deserialize resulting XML afterwards.


The correct approach to this problem would be to validate user input or if the field has to contain control characters it should be declared as binary.

A workaround would be to remove control characters from AxUsers-fields, starting with AxUser.Comment field.
An example of a control character is char(13) or char(10) (Line Break).

APPLIES TO versions: before 8.0