This topic has not yet been rated - Rate this topic

WebMessageEncodingElement.WriteEncoding Property

Gets or sets the character set encoding to be used for emitting messages on the binding.

Namespace:  System.ServiceModel.Configuration
Assembly:  System.ServiceModel.Web (in System.ServiceModel.Web.dll)
[ConfigurationPropertyAttribute("writeEncoding", DefaultValue = "utf-8")]
public Encoding WriteEncoding { get; set; }

Property Value

Type: System.Text.Encoding
A valid Encoding value that specifies the character set encoding to be used for emitting messages on the binding. The default is UTF8Encoding.
ExceptionCondition
ArgumentNullException

The value set is null.

using System;
using System.Text;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.ServiceModel.Configuration;

static void Main()
{
    Encoding webMessageEncoding = webMEE.WriteEncoding;
    Console.WriteLine("The write encoding is: {0}",     webMessageEncoding);
    webMessageEncoding = UnicodeEncoding.Unicode;
    Console.WriteLine("The write encoding has been changed to: {0}", webMessageEncoding);
}

.NET Framework

Supported in: 4.5, 4, 3.5

.NET Framework Client Profile

Supported in: 3.5 SP1

Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.