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
- CommandEventArgs.cs
- ToolStripArrowRenderEventArgs.cs
- Timeline.cs
- SolidBrush.cs
- ReliableChannelFactory.cs
- SettingsProviderCollection.cs
- Hyperlink.cs
- MediaElement.cs
- FactoryMaker.cs
- BitmapMetadataEnumerator.cs
- GridViewUpdateEventArgs.cs
- TemporaryBitmapFile.cs
- DefaultValueConverter.cs
- selecteditemcollection.cs
- BamlVersionHeader.cs
- OleServicesContext.cs
- ColumnResizeUndoUnit.cs
- _SslState.cs
- RayMeshGeometry3DHitTestResult.cs
- BinaryParser.cs
- Page.cs
- WebPartMinimizeVerb.cs
- OutputScopeManager.cs
- documentsequencetextcontainer.cs
- UnsafeNativeMethods.cs
- WhitespaceRule.cs
- PartialTrustVisibleAssembliesSection.cs
- PasswordPropertyTextAttribute.cs
- TypeUtil.cs
- TextSerializer.cs
- ExpressionVisitorHelpers.cs
- Rotation3D.cs
- TextSelectionHighlightLayer.cs
- ReliableInputConnection.cs
- XmlDownloadManager.cs
- RelatedImageListAttribute.cs
- CharConverter.cs
- D3DImage.cs
- MouseWheelEventArgs.cs
- PrintPageEvent.cs
- SamlDoNotCacheCondition.cs
- XmlElementCollection.cs
- SignatureGenerator.cs
- TraceSource.cs
- PerformanceCounterPermissionAttribute.cs
- XhtmlTextWriter.cs
- DataBindingCollection.cs
- PenContexts.cs
- EndpointInstanceProvider.cs
- SerializerDescriptor.cs
- UnauthorizedWebPart.cs
- BitmapFrameDecode.cs
- HMACSHA512.cs
- DateBoldEvent.cs
- DbProviderFactoriesConfigurationHandler.cs
- FormViewPageEventArgs.cs
- HtmlInputControl.cs
- DesignerDeviceConfig.cs
- httpapplicationstate.cs
- InfoCardServiceInstallComponent.cs
- OpacityConverter.cs
- Size.cs
- CodeEntryPointMethod.cs
- PrintDialog.cs
- InitiatorSessionSymmetricTransportSecurityProtocol.cs
- Rotation3DKeyFrameCollection.cs
- WinFormsComponentEditor.cs
- ContentElement.cs
- EditorPartDesigner.cs
- ConsumerConnectionPointCollection.cs
- KeyValueSerializer.cs
- ServiceModelEnumValidator.cs
- ListViewItem.cs
- SafePEFileHandle.cs
- VectorValueSerializer.cs
- ConsumerConnectionPointCollection.cs
- ThreadExceptionEvent.cs
- Dump.cs
- PcmConverter.cs
- SafeWaitHandle.cs
- WebServicesSection.cs
- ProcessThread.cs
- SerTrace.cs
- XmlText.cs
- DockAndAnchorLayout.cs
- SqlTriggerContext.cs
- VsPropertyGrid.cs
- NullExtension.cs
- Context.cs
- RouteParametersHelper.cs
- jithelpers.cs
- JpegBitmapDecoder.cs
- SharedPersonalizationStateInfo.cs
- XsltConvert.cs
- PropertiesTab.cs
- EntityProviderFactory.cs
- SelectionUIService.cs
- DirectoryInfo.cs
- XamlToRtfWriter.cs
- XmlHierarchicalEnumerable.cs