Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Net / System / Net / Configuration / HttpWebRequestElement.cs / 1 / HttpWebRequestElement.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Net.Configuration { using System; using System.Configuration; using System.Reflection; using System.Security.Permissions; public sealed class HttpWebRequestElement : ConfigurationElement { public HttpWebRequestElement() { this.properties.Add(this.maximumResponseHeadersLength); this.properties.Add(this.maximumErrorResponseLength); this.properties.Add(this.maximumUnauthorizedUploadLength); this.properties.Add(this.useUnsafeHeaderParsing); } protected override void PostDeserialize() { // Perf optimization. If the configuration is coming from machine.config // It is safe and we don't need to check for permissions. if (EvaluationContext.IsMachineLevel) return; PropertyInformation[] protectedProperties = { ElementInformation.Properties[ConfigurationStrings.MaximumResponseHeadersLength], ElementInformation.Properties[ConfigurationStrings.MaximumErrorResponseLength] }; foreach (PropertyInformation property in protectedProperties) if (property.ValueOrigin == PropertyValueOrigin.SetHere) { try { ExceptionHelper.WebPermissionUnrestricted.Demand(); } catch (Exception exception) { throw new ConfigurationErrorsException( SR.GetString(SR.net_config_property_permission, property.Name), exception); } } } protected override ConfigurationPropertyCollection Properties { get { return this.properties; } } [ConfigurationProperty(ConfigurationStrings.maximumUnauthorizedUploadLength, DefaultValue=(int)(-1))] public int MaximumUnauthorizedUploadLength { get { return (int)this[this.maximumUnauthorizedUploadLength]; } set { this[this.maximumUnauthorizedUploadLength] = value; } } [ConfigurationProperty(ConfigurationStrings.MaximumErrorResponseLength, DefaultValue=(int)(64))] public int MaximumErrorResponseLength { get { return (int)this[this.maximumErrorResponseLength]; } set { this[this.maximumErrorResponseLength] = value; } } [ConfigurationProperty(ConfigurationStrings.MaximumResponseHeadersLength, DefaultValue= 64)] public int MaximumResponseHeadersLength { get { return (int)this[this.maximumResponseHeadersLength]; } set { this[this.maximumResponseHeadersLength] = value; } } [ConfigurationProperty(ConfigurationStrings.UseUnsafeHeaderParsing, DefaultValue= false)] public bool UseUnsafeHeaderParsing { get { return (bool) this[this.useUnsafeHeaderParsing]; } set { this[this.useUnsafeHeaderParsing] = value; } } ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection(); readonly ConfigurationProperty maximumResponseHeadersLength = new ConfigurationProperty(ConfigurationStrings.MaximumResponseHeadersLength, typeof(int), 64, ConfigurationPropertyOptions.None); readonly ConfigurationProperty maximumErrorResponseLength = new ConfigurationProperty(ConfigurationStrings.MaximumErrorResponseLength, typeof(int), 64, ConfigurationPropertyOptions.None); readonly ConfigurationProperty maximumUnauthorizedUploadLength = new ConfigurationProperty(ConfigurationStrings.maximumUnauthorizedUploadLength, typeof(int), -1, ConfigurationPropertyOptions.None); readonly ConfigurationProperty useUnsafeHeaderParsing = new ConfigurationProperty(ConfigurationStrings.UseUnsafeHeaderParsing, typeof(bool), false, ConfigurationPropertyOptions.None); } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- RecommendedAsConfigurableAttribute.cs
- CellTreeNode.cs
- LinearGradientBrush.cs
- MbpInfo.cs
- BitmapEffectCollection.cs
- SvcMapFileLoader.cs
- ButtonChrome.cs
- RegisteredDisposeScript.cs
- EdmError.cs
- HttpConfigurationSystem.cs
- FamilyMap.cs
- PartialCachingAttribute.cs
- ImageMap.cs
- ColorConvertedBitmap.cs
- BitmapPalettes.cs
- DataGridViewRowEventArgs.cs
- safelink.cs
- RealProxy.cs
- QilValidationVisitor.cs
- WaitHandle.cs
- XmlSchemaObjectTable.cs
- ReadOnlyDataSourceView.cs
- CreateSequence.cs
- InkPresenter.cs
- XmlSortKey.cs
- XmlSerializationGeneratedCode.cs
- TypographyProperties.cs
- TdsParserStateObject.cs
- WSSecurityOneDotOneReceiveSecurityHeader.cs
- WebPageTraceListener.cs
- ClusterRegistryConfigurationProvider.cs
- MimeBasePart.cs
- DefinitionBase.cs
- dtdvalidator.cs
- ControlParameter.cs
- SqlFactory.cs
- DataGridViewCellValidatingEventArgs.cs
- ListBindingHelper.cs
- HybridObjectCache.cs
- ObjectParameterCollection.cs
- arabicshape.cs
- RenderData.cs
- ServiceEndpointCollection.cs
- BitVector32.cs
- DiscoveryServerProtocol.cs
- WindowsGraphicsWrapper.cs
- BuildManager.cs
- ObjectDataSourceMethodEventArgs.cs
- ContextProperty.cs
- SourceFileBuildProvider.cs
- WindowsListViewScroll.cs
- DnsEndPoint.cs
- SystemParameters.cs
- DelegatingMessage.cs
- KnownTypeDataContractResolver.cs
- AttributeUsageAttribute.cs
- XamlStream.cs
- Rotation3DKeyFrameCollection.cs
- FileInfo.cs
- NumericUpDownAccelerationCollection.cs
- SqlBuffer.cs
- IISMapPath.cs
- UnicastIPAddressInformationCollection.cs
- InputMethodStateChangeEventArgs.cs
- _AutoWebProxyScriptWrapper.cs
- __Filters.cs
- ConstructorNeedsTagAttribute.cs
- ReliableSessionBindingElementImporter.cs
- SamlAttributeStatement.cs
- _ConnectionGroup.cs
- TextRangeEditTables.cs
- ProfileModule.cs
- ButtonChrome.cs
- ButtonChrome.cs
- TextStore.cs
- DataPointer.cs
- HtmlHistory.cs
- RIPEMD160Managed.cs
- DataGridLength.cs
- SubordinateTransaction.cs
- Timeline.cs
- MultiBindingExpression.cs
- DirectoryInfo.cs
- StringHandle.cs
- Codec.cs
- HttpCacheParams.cs
- odbcmetadatafactory.cs
- HitTestParameters.cs
- UdpDiscoveryEndpointProvider.cs
- SocketPermission.cs
- MTConfigUtil.cs
- sapiproxy.cs
- FixedSOMLineCollection.cs
- InArgument.cs
- Group.cs
- ObjectSet.cs
- TabControl.cs
- BrowserInteropHelper.cs
- RecordManager.cs
- XmlUtf8RawTextWriter.cs