Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Extensions / Configuration / ScriptingJsonSerializationSection.cs / 1305376 / ScriptingJsonSerializationSection.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Configuration { using System; using System.Configuration; using System.Web; using System.Web.Configuration; using System.Web.Script.Serialization; 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
- ISAPIRuntime.cs
- ImageList.cs
- TableLayoutPanelCellPosition.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- SrgsRuleRef.cs
- PeerCollaboration.cs
- X500Name.cs
- DataSourceProvider.cs
- NativeObjectSecurity.cs
- DesignerTransactionCloseEvent.cs
- IsolatedStorageFilePermission.cs
- AdjustableArrowCap.cs
- ComponentCache.cs
- MemoryPressure.cs
- FixedElement.cs
- SQLMoneyStorage.cs
- CaretElement.cs
- SchemaTypeEmitter.cs
- SecurityPermission.cs
- EdmEntityTypeAttribute.cs
- TemplateKeyConverter.cs
- SQLDateTimeStorage.cs
- Point3DIndependentAnimationStorage.cs
- ToolStripDropDownItem.cs
- Model3D.cs
- PropertyCondition.cs
- NeutralResourcesLanguageAttribute.cs
- ScrollBar.cs
- LockCookie.cs
- xml.cs
- AccessDataSourceView.cs
- ListDictionaryInternal.cs
- SecurityElement.cs
- ValidationSummary.cs
- PropertyStore.cs
- HandoffBehavior.cs
- MDIWindowDialog.cs
- DefaultSection.cs
- MdImport.cs
- EntityDataSourceEntityTypeFilterItem.cs
- DrawListViewColumnHeaderEventArgs.cs
- SqlClientMetaDataCollectionNames.cs
- UserControlCodeDomTreeGenerator.cs
- ListSortDescription.cs
- BamlBinaryReader.cs
- XmlWriterTraceListener.cs
- MetadataUtil.cs
- PrimitiveDataContract.cs
- ResourceReferenceExpressionConverter.cs
- HyperLink.cs
- AliasedSlot.cs
- XmlDataDocument.cs
- SkewTransform.cs
- HostSecurityManager.cs
- WebPartCatalogAddVerb.cs
- ByeOperation11AsyncResult.cs
- EventDescriptor.cs
- IgnoreSection.cs
- DataServiceKeyAttribute.cs
- ImageClickEventArgs.cs
- ConfigurationValue.cs
- XmlCharCheckingReader.cs
- Vector.cs
- X509WindowsSecurityToken.cs
- ImpersonationContext.cs
- EditorAttribute.cs
- SafeUserTokenHandle.cs
- NewItemsContextMenuStrip.cs
- Rotation3DKeyFrameCollection.cs
- WindowHideOrCloseTracker.cs
- CategoryGridEntry.cs
- WorkflowMarkupElementEventArgs.cs
- RuleRefElement.cs
- ServicePointManagerElement.cs
- Help.cs
- BindingNavigator.cs
- StateWorkerRequest.cs
- XmlWhitespace.cs
- InputLanguageProfileNotifySink.cs
- WinFormsUtils.cs
- RbTree.cs
- TreeChangeInfo.cs
- XmlNamespaceDeclarationsAttribute.cs
- XmlWriterTraceListener.cs
- SafeArrayTypeMismatchException.cs
- Attributes.cs
- PerfCounters.cs
- SHA1Managed.cs
- EpmHelper.cs
- LinqDataView.cs
- RedistVersionInfo.cs
- PictureBox.cs
- WebBrowserContainer.cs
- SecurityPermission.cs
- FileDataSourceCache.cs
- HandlerFactoryWrapper.cs
- StrongNameIdentityPermission.cs
- MetaModel.cs
- WSFederationHttpSecurityMode.cs
- ColumnWidthChangedEvent.cs