Converter Class
Represents a configuration element in a configuration file.
Assembly: System.Web.Extensions (in System.Web.Extensions.dll)
The Converter class enables you to programmatically access and modify the configuration settings related to converters that are used by AJAX-enabled ASP.NET applications.
To create custom conversion functionality, you can create a class that inherits from the JavaScriptConverter class. After the converter has been created, you can register it for use in the configuration file of your Web application.
The following configuration file excerpt shows how to declaratively specify values for properties of the Converter class.
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization>
<converters>
<add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter" />
</converters>
</jsonSerialization>
</webServices>
</scripting>
</system.web.extensions>
The following example demonstrates how to access Converter programmatically.
// Get the Web application configuration. System.Configuration.Configuration configuration = WebConfigurationManager.OpenWebConfiguration("/aspnetTest"); // Get the external JSON section. ScriptingJsonSerializationSection jsonSection = (ScriptingJsonSerializationSection)configuration.GetSection( "system.web.extensions/scripting/webServices/jsonSerialization"); //Get the converters collection. ConvertersCollection converters = jsonSection.Converters; if ((converters != null) && converters.Count > 0) { // Get the first registered converter. Converter converterElement = converters[0]; }
- AspNetHostingPermission
for operating in a hosted environment. Demand value: LinkDemand. Associated enumeration: AspNetHostingPermissionLevel.Minimal
- AspNetHostingPermission
for operating in a hosted environment. Demand value: InheritanceDemand. Associated enumeration: AspNetHostingPermissionLevel.Minimal
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.