Documentation for: ASP.NET Ajax Version 1.0

This documentation is for a previous version. For the current released version, see the ASP.NET Ajax documentation on MSDN.

 

 

 

 

 

 

 

XmlSerializeString Property

Gets or sets a value indicating whether all return types are serialized as XML, including string types.

Syntax

CSharp

public bool XmlSerializeString { get; set; }

VisualBasic

Public Property XmlSerializeString As Boolean

ManagedCPlusPlus

public:
bool XmlSerializeString {
	bool get ();
	void set (bool value);
}

JSharp

/** @property */
/** @property */

Value

Return Value

true if all return types are serialized as XML; otherwise, false. The default is false.

Remarks

When this property is set to false, all return types are serialized as XML, except string, which is interpreted as XML markup. If the return type is a string and the string does not contain XML markup that corresponds to a well-formed XML document, then the succeeded callback function will be invoked but the resulting serialized string will be null.

The value of XmlSerializeString is ignored when the ResponseFormat property is set to Json.

Examples

The following example shows how to apply ScriptMethodAttribute to a Web method with the XmlSerializeString property set to true. This code example is part of a larger example provided for the ScriptMethodAttribute class.

CS

[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Xml, 
    XmlSerializeString = true)]
public string GetString()
{
    return "Hello World";           
}

VB

<WebMethod()> _
<ScriptMethod(ResponseFormat:=ResponseFormat.Xml, _
    XmlSerializeString:=True)> _
Public Function GetString() As String
    Return "Hello World"
End Function

Assembly: System.Web.Extensions (Module: System.Web.Extensions)