Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / ndp / fx / src / xsp / System / Web / Extensions / Configuration / ScriptingJsonSerializationSection.cs / 1 / ScriptingJsonSerializationSection.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Configuration { using System; using System.Configuration; using System.Security.Permissions; using System.Web; using System.Web.Configuration; using System.Web.Script.Serialization; [AspNetHostingPermission(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)] public sealed class ScriptingJsonSerializationSection : ConfigurationSection { private static readonly ConfigurationProperty _propConverters = new ConfigurationProperty("converters", typeof(ConvertersCollection), null, ConfigurationPropertyOptions.IsDefaultCollection); private static readonly ConfigurationProperty _propRecursionLimitLimit = new ConfigurationProperty("recursionLimit", typeof(int), 100, null, new IntegerValidator(1, int.MaxValue), ConfigurationPropertyOptions.None); private static readonly ConfigurationProperty _propMaxJsonLength = new ConfigurationProperty("maxJsonLength", typeof(int), 102400, null, new IntegerValidator(1, int.MaxValue), ConfigurationPropertyOptions.None); private static ConfigurationPropertyCollection _properties = BuildProperties(); private static ConfigurationPropertyCollection BuildProperties() { ConfigurationPropertyCollection props = new ConfigurationPropertyCollection(); props.Add(_propConverters); props.Add(_propRecursionLimitLimit); props.Add(_propMaxJsonLength); return props; } protected override ConfigurationPropertyCollection Properties { get { return _properties; } } [ConfigurationProperty("converters", IsKey = true, DefaultValue = "")] public ConvertersCollection Converters { get { return (ConvertersCollection)base[_propConverters]; } } [ConfigurationProperty("recursionLimit", DefaultValue = 100)] public int RecursionLimit { get { return (int)base[_propRecursionLimitLimit]; } set { base[_propRecursionLimitLimit] = value; } } [ConfigurationProperty("maxJsonLength", DefaultValue = 102400)] public int MaxJsonLength { get { return (int)base[_propMaxJsonLength]; } set { base[_propMaxJsonLength] = value; } } internal class ApplicationSettings { private int _recusionLimit; private int _maxJsonLimit; private JavaScriptConverter[] _converters; internal ApplicationSettings() { #pragma warning disable 0436 ScriptingJsonSerializationSection section = (ScriptingJsonSerializationSection) WebConfigurationManager.GetSection("system.web.extensions/scripting/webServices/jsonSerialization"); #pragma warning restore 0436 if (section != null) { _recusionLimit = section.RecursionLimit; _maxJsonLimit = section.MaxJsonLength; _converters = section.Converters.CreateConverters(); } else { _recusionLimit = (int)_propRecursionLimitLimit.DefaultValue; _maxJsonLimit = (int)_propMaxJsonLength.DefaultValue; _converters = new JavaScriptConverter[0]; } } internal int RecursionLimit { get { return _recusionLimit; } } internal int MaxJsonLimit { get { return _maxJsonLimit; } } internal JavaScriptConverter[] Converters { get { return _converters; } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Configuration { using System; using System.Configuration; using System.Security.Permissions; using System.Web; using System.Web.Configuration; using System.Web.Script.Serialization; [AspNetHostingPermission(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)] public sealed class ScriptingJsonSerializationSection : ConfigurationSection { private static readonly ConfigurationProperty _propConverters = new ConfigurationProperty("converters", typeof(ConvertersCollection), null, ConfigurationPropertyOptions.IsDefaultCollection); private static readonly ConfigurationProperty _propRecursionLimitLimit = new ConfigurationProperty("recursionLimit", typeof(int), 100, null, new IntegerValidator(1, int.MaxValue), ConfigurationPropertyOptions.None); private static readonly ConfigurationProperty _propMaxJsonLength = new ConfigurationProperty("maxJsonLength", typeof(int), 102400, null, new IntegerValidator(1, int.MaxValue), ConfigurationPropertyOptions.None); private static ConfigurationPropertyCollection _properties = BuildProperties(); private static ConfigurationPropertyCollection BuildProperties() { ConfigurationPropertyCollection props = new ConfigurationPropertyCollection(); props.Add(_propConverters); props.Add(_propRecursionLimitLimit); props.Add(_propMaxJsonLength); return props; } protected override ConfigurationPropertyCollection Properties { get { return _properties; } } [ConfigurationProperty("converters", IsKey = true, DefaultValue = "")] public ConvertersCollection Converters { get { return (ConvertersCollection)base[_propConverters]; } } [ConfigurationProperty("recursionLimit", DefaultValue = 100)] public int RecursionLimit { get { return (int)base[_propRecursionLimitLimit]; } set { base[_propRecursionLimitLimit] = value; } } [ConfigurationProperty("maxJsonLength", DefaultValue = 102400)] public int MaxJsonLength { get { return (int)base[_propMaxJsonLength]; } set { base[_propMaxJsonLength] = value; } } internal class ApplicationSettings { private int _recusionLimit; private int _maxJsonLimit; private JavaScriptConverter[] _converters; internal ApplicationSettings() { #pragma warning disable 0436 ScriptingJsonSerializationSection section = (ScriptingJsonSerializationSection) WebConfigurationManager.GetSection("system.web.extensions/scripting/webServices/jsonSerialization"); #pragma warning restore 0436 if (section != null) { _recusionLimit = section.RecursionLimit; _maxJsonLimit = section.MaxJsonLength; _converters = section.Converters.CreateConverters(); } else { _recusionLimit = (int)_propRecursionLimitLimit.DefaultValue; _maxJsonLimit = (int)_propMaxJsonLength.DefaultValue; _converters = new JavaScriptConverter[0]; } } internal int RecursionLimit { get { return _recusionLimit; } } internal int MaxJsonLimit { get { return _maxJsonLimit; } } internal JavaScriptConverter[] Converters { get { return _converters; } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- FrameworkElementFactory.cs
- WebPartZoneCollection.cs
- ClientConfigPaths.cs
- CodeTypeReferenceSerializer.cs
- ColorAnimation.cs
- NumericUpDownAccelerationCollection.cs
- MetaType.cs
- MdiWindowListStrip.cs
- UxThemeWrapper.cs
- MarshalDirectiveException.cs
- BufferModesCollection.cs
- Geometry.cs
- WebPartZoneCollection.cs
- AspCompat.cs
- HttpEncoderUtility.cs
- DateTimePicker.cs
- WorkflowCommandExtensionItem.cs
- RequestCachingSection.cs
- SocketElement.cs
- TypeReference.cs
- CodeDOMProvider.cs
- TextCompositionManager.cs
- PersistChildrenAttribute.cs
- WorkflowTransactionOptions.cs
- SafeCryptoHandles.cs
- TextRangeProviderWrapper.cs
- PageStatePersister.cs
- InputScopeConverter.cs
- ComEventsInfo.cs
- DataViewSettingCollection.cs
- SQLInt32.cs
- ExpressionPrinter.cs
- ClrProviderManifest.cs
- SystemWebSectionGroup.cs
- CompilerResults.cs
- ColorTranslator.cs
- BoundField.cs
- PopupRoot.cs
- SQLDoubleStorage.cs
- NativeMethods.cs
- IndexedGlyphRun.cs
- LabelInfo.cs
- SchemaLookupTable.cs
- EncryptedReference.cs
- StorageAssociationSetMapping.cs
- MsmqQueue.cs
- SingleConverter.cs
- MenuItemBinding.cs
- StoryFragments.cs
- DllNotFoundException.cs
- LookupBindingPropertiesAttribute.cs
- BrowserDefinition.cs
- Pts.cs
- AsymmetricSignatureFormatter.cs
- ConfigXmlSignificantWhitespace.cs
- Model3DGroup.cs
- SerializerProvider.cs
- BookmarkWorkItem.cs
- Cursors.cs
- InternalSafeNativeMethods.cs
- XmlTypeMapping.cs
- UnsafeNativeMethods.cs
- XmlReflectionImporter.cs
- XmlAttributeCollection.cs
- RC2CryptoServiceProvider.cs
- DataGridItemEventArgs.cs
- IChannel.cs
- Timer.cs
- InternalMappingException.cs
- RowTypePropertyElement.cs
- StylusPointProperties.cs
- RepeatButton.cs
- Content.cs
- SqlDependency.cs
- SecurityPolicySection.cs
- TraceContextEventArgs.cs
- XmlNodeReader.cs
- RijndaelManaged.cs
- BindingExpressionUncommonField.cs
- TreeNodeBinding.cs
- UnsafeMethods.cs
- TextServicesContext.cs
- MeasurementDCInfo.cs
- UnicodeEncoding.cs
- ConnectionStringsExpressionBuilder.cs
- InputMethodStateChangeEventArgs.cs
- XXXOnTypeBuilderInstantiation.cs
- SQLSingleStorage.cs
- MatcherBuilder.cs
- HttpContextServiceHost.cs
- EventDescriptorCollection.cs
- Localizer.cs
- NetTcpSecurityElement.cs
- HotCommands.cs
- DataStorage.cs
- ProcessModuleCollection.cs
- CanonicalFontFamilyReference.cs
- ViewBox.cs
- ComNativeDescriptor.cs
- HebrewCalendar.cs