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
- ValueConversionAttribute.cs
- DataGridViewColumnEventArgs.cs
- ConnectionPoolManager.cs
- ReflectPropertyDescriptor.cs
- TransportSecurityHelpers.cs
- SystemIPInterfaceProperties.cs
- Visual3D.cs
- ObjectContextServiceProvider.cs
- PlainXmlSerializer.cs
- SimpleWorkerRequest.cs
- DrawingContextWalker.cs
- FragmentNavigationEventArgs.cs
- AssemblyHash.cs
- DataGridViewCellCollection.cs
- ValidationContext.cs
- CommonProperties.cs
- ADMembershipProvider.cs
- TimeStampChecker.cs
- MatchAttribute.cs
- StreamGeometryContext.cs
- _SingleItemRequestCache.cs
- CodeGeneratorOptions.cs
- DataGridViewSelectedRowCollection.cs
- ReverseComparer.cs
- ValueType.cs
- SafeSerializationManager.cs
- CellIdBoolean.cs
- BitmapEffectGroup.cs
- HttpCookiesSection.cs
- AssociationSetEnd.cs
- DataGridViewRowCollection.cs
- RegistrationServices.cs
- _HTTPDateParse.cs
- TemplateApplicationHelper.cs
- PointAnimationUsingKeyFrames.cs
- EventProviderWriter.cs
- RegionInfo.cs
- ModelFunctionTypeElement.cs
- ChineseLunisolarCalendar.cs
- IPAddress.cs
- DynamicRendererThreadManager.cs
- SafeViewOfFileHandle.cs
- OneToOneMappingSerializer.cs
- TdsParserHelperClasses.cs
- RowToFieldTransformer.cs
- DefaultMemberAttribute.cs
- Operators.cs
- MembershipValidatePasswordEventArgs.cs
- BitStream.cs
- ScrollBarAutomationPeer.cs
- UrlAuthorizationModule.cs
- FixedFlowMap.cs
- EpmSyndicationContentSerializer.cs
- ExtenderControl.cs
- sqlpipe.cs
- InputBuffer.cs
- GroupBox.cs
- SecurityTokenInclusionMode.cs
- FileDialogPermission.cs
- SQLInt16Storage.cs
- SqlStream.cs
- TypeSemantics.cs
- ConfigViewGenerator.cs
- ComponentManagerBroker.cs
- DefaultBinder.cs
- CompatibleComparer.cs
- Vector3DCollection.cs
- DispatcherEventArgs.cs
- DocumentSchemaValidator.cs
- PresentationSource.cs
- ActivityScheduledRecord.cs
- ZipArchive.cs
- TextElementEditingBehaviorAttribute.cs
- CompilationSection.cs
- LogRecordSequence.cs
- SQLChars.cs
- Padding.cs
- SettingsAttributes.cs
- SerializationInfo.cs
- RowSpanVector.cs
- TrustManagerPromptUI.cs
- StateDesigner.LayoutSelectionGlyph.cs
- WindowsIPAddress.cs
- EpmHelper.cs
- Lease.cs
- HttpResponseHeader.cs
- SqlUdtInfo.cs
- BuildResultCache.cs
- DockAndAnchorLayout.cs
- MinMaxParagraphWidth.cs
- DataGridViewControlCollection.cs
- Matrix3DValueSerializer.cs
- NetSectionGroup.cs
- SoapAttributeAttribute.cs
- EventMetadata.cs
- RawStylusSystemGestureInputReport.cs
- LocatorManager.cs
- WindowsToolbarItemAsMenuItem.cs
- OutOfProcStateClientManager.cs
- GeneralTransformCollection.cs