Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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); } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// 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); } } // 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
- Point3D.cs
- XmlAttributeOverrides.cs
- followingquery.cs
- DependencyPropertyDescriptor.cs
- ToolStripAdornerWindowService.cs
- DataGridViewElement.cs
- ConcurrencyMode.cs
- SmiSettersStream.cs
- SqlDataSourceQueryConverter.cs
- WeakEventTable.cs
- CustomActivityDesigner.cs
- StructuralComparisons.cs
- DataColumnMapping.cs
- PackageDigitalSignature.cs
- Mapping.cs
- CodeDOMUtility.cs
- StringPropertyBuilder.cs
- EntityTypeBase.cs
- EDesignUtil.cs
- SolidBrush.cs
- Expression.cs
- ActivityExecutionContextCollection.cs
- SourceLineInfo.cs
- FileLoadException.cs
- DataGridViewLayoutData.cs
- SoapEnvelopeProcessingElement.cs
- TriggerCollection.cs
- SafeEventLogWriteHandle.cs
- UserNameSecurityToken.cs
- FrameworkReadOnlyPropertyMetadata.cs
- CollectionView.cs
- TemplateControlParser.cs
- RtfNavigator.cs
- ListDictionary.cs
- ModelItemDictionaryImpl.cs
- DataPagerFieldItem.cs
- InputScope.cs
- Typeface.cs
- FlowPosition.cs
- HtmlSelect.cs
- ExtensionSimplifierMarkupObject.cs
- ScriptingJsonSerializationSection.cs
- ResourceWriter.cs
- FormsIdentity.cs
- AsyncStreamReader.cs
- SqlUserDefinedTypeAttribute.cs
- OleDbConnectionFactory.cs
- InternalRelationshipCollection.cs
- MergablePropertyAttribute.cs
- DataListItemEventArgs.cs
- MetricEntry.cs
- FixedDocumentPaginator.cs
- ListenerConstants.cs
- TransformGroup.cs
- ExtensionCollection.cs
- RTLAwareMessageBox.cs
- CheckBoxPopupAdapter.cs
- BulletedList.cs
- FixedSOMTextRun.cs
- ItemsControl.cs
- StyleBamlTreeBuilder.cs
- HtmlImage.cs
- LocatorManager.cs
- CustomWebEventKey.cs
- BasicKeyConstraint.cs
- MissingFieldException.cs
- FrameworkElementAutomationPeer.cs
- ViewGenerator.cs
- Icon.cs
- TemplatedMailWebEventProvider.cs
- odbcmetadatacollectionnames.cs
- IPPacketInformation.cs
- ParallelTimeline.cs
- ObjectListDataBindEventArgs.cs
- BitmapEffectState.cs
- SafeNativeMethods.cs
- Membership.cs
- ServerValidateEventArgs.cs
- DynamicUpdateCommand.cs
- HttpServerUtilityWrapper.cs
- BitmapEffectInput.cs
- ApplicationFileCodeDomTreeGenerator.cs
- UInt64.cs
- Asn1IntegerConverter.cs
- PrintingPermissionAttribute.cs
- MenuItem.cs
- QilTargetType.cs
- BinHexEncoder.cs
- TextElementEnumerator.cs
- ColorConvertedBitmap.cs
- CodeGeneratorOptions.cs
- LayoutTable.cs
- GlobalizationSection.cs
- TextureBrush.cs
- ChunkedMemoryStream.cs
- ProgressBarRenderer.cs
- StylusTip.cs
- ThicknessConverter.cs
- MatrixAnimationUsingPath.cs
- CorruptingExceptionCommon.cs