Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- ReferentialConstraint.cs
- OpacityConverter.cs
- CalendarSelectionChangedEventArgs.cs
- CommandHelpers.cs
- ClientSponsor.cs
- Renderer.cs
- TabletDevice.cs
- Argument.cs
- DesignBindingValueUIHandler.cs
- EnumValAlphaComparer.cs
- DataProtection.cs
- AutoSizeToolBoxItem.cs
- SHA512.cs
- InputMethodStateTypeInfo.cs
- RegexStringValidatorAttribute.cs
- GeneratedView.cs
- BaseCodePageEncoding.cs
- ConfigurationManagerInternalFactory.cs
- PropertyDescriptorCollection.cs
- LinearGradientBrush.cs
- MemberMemberBinding.cs
- DebugControllerThread.cs
- PageTheme.cs
- ConnectionConsumerAttribute.cs
- Wizard.cs
- ByteConverter.cs
- KnownTypeAttribute.cs
- ReadOnlyDataSource.cs
- Int16Converter.cs
- CompoundFileStorageReference.cs
- DocumentSequenceHighlightLayer.cs
- WebCategoryAttribute.cs
- HijriCalendar.cs
- DesignerTransactionCloseEvent.cs
- CustomLineCap.cs
- SubstitutionResponseElement.cs
- JulianCalendar.cs
- XmlQualifiedNameTest.cs
- PreDigestedSignedInfo.cs
- DataRow.cs
- AssertFilter.cs
- PrincipalPermission.cs
- ConsoleTraceListener.cs
- RefreshEventArgs.cs
- DynamicILGenerator.cs
- ScriptControlDescriptor.cs
- DBConcurrencyException.cs
- RenderCapability.cs
- RelatedEnd.cs
- QuotedPrintableStream.cs
- XappLauncher.cs
- HtmlInputText.cs
- ObjectPropertyMapping.cs
- CustomAttributeFormatException.cs
- InstallerTypeAttribute.cs
- UnitySerializationHolder.cs
- MappingItemCollection.cs
- DataStreams.cs
- DBPropSet.cs
- StringResourceManager.cs
- TempFiles.cs
- RegexTypeEditor.cs
- SByteConverter.cs
- ThousandthOfEmRealDoubles.cs
- RewritingValidator.cs
- NativeMethods.cs
- UIElement3D.cs
- HwndSourceKeyboardInputSite.cs
- MultipartContentParser.cs
- ArraySegment.cs
- WorkflowDesigner.cs
- ObjectDataSourceView.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- XmlTextReader.cs
- OpenTypeCommon.cs
- ObjectViewListener.cs
- QueryResult.cs
- DetailsViewInsertedEventArgs.cs
- ListViewItemMouseHoverEvent.cs
- Pointer.cs
- CFGGrammar.cs
- BinaryReader.cs
- ProcessModule.cs
- PropertyGridEditorPart.cs
- ExceptionTrace.cs
- RotateTransform.cs
- BinaryFormatterSinks.cs
- StickyNote.cs
- HtmlTextArea.cs
- SoapReflector.cs
- EditCommandColumn.cs
- IChannel.cs
- KeyValueSerializer.cs
- ConnectionOrientedTransportBindingElement.cs
- MessageBuffer.cs
- OdbcErrorCollection.cs
- XmlCDATASection.cs
- ProgramNode.cs
- CodePageUtils.cs
- Vector3dCollection.cs