Code:
/ DotNET / DotNET / 8.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
- ReferencedAssembly.cs
- SHA1Cng.cs
- GridViewRowPresenterBase.cs
- SemaphoreFullException.cs
- SqlInternalConnectionTds.cs
- SourceInterpreter.cs
- BindingExpressionUncommonField.cs
- DataConnectionHelper.cs
- TextUtf8RawTextWriter.cs
- InputProcessorProfiles.cs
- XPathParser.cs
- RoleBoolean.cs
- DurationConverter.cs
- CommandEventArgs.cs
- SafeNativeMethods.cs
- HwndSubclass.cs
- ListDictionaryInternal.cs
- FigureParagraph.cs
- WebPartEditorOkVerb.cs
- ProfileSection.cs
- SequentialWorkflowRootDesigner.cs
- ControlCollection.cs
- Preprocessor.cs
- streamingZipPartStream.cs
- DataKey.cs
- XmlDictionaryWriter.cs
- ValidationEventArgs.cs
- DrawItemEvent.cs
- Attributes.cs
- Literal.cs
- wpf-etw.cs
- Aggregates.cs
- XmlSchemaGroupRef.cs
- PageEventArgs.cs
- UriWriter.cs
- PerfService.cs
- PerformanceCounterManager.cs
- CustomWebEventKey.cs
- ConstructorBuilder.cs
- TypeGeneratedEventArgs.cs
- AxHost.cs
- AggregateNode.cs
- QilValidationVisitor.cs
- SocketAddress.cs
- UIElementAutomationPeer.cs
- CombinedGeometry.cs
- LineSegment.cs
- CqlLexerHelpers.cs
- SHA256.cs
- IdlingCommunicationPool.cs
- TableItemPatternIdentifiers.cs
- BindingParameterCollection.cs
- XmlSchemaIdentityConstraint.cs
- GridViewEditEventArgs.cs
- unsafenativemethodsother.cs
- HttpModulesSection.cs
- EdmProperty.cs
- ListViewGroupConverter.cs
- GeneralTransform2DTo3D.cs
- InkPresenterAutomationPeer.cs
- Deflater.cs
- ThreadInterruptedException.cs
- FileSystemInfo.cs
- EntityDataSourceConfigureObjectContext.cs
- XMLDiffLoader.cs
- SortDescription.cs
- XmlSchemaElement.cs
- EntityContainer.cs
- WebPartAddingEventArgs.cs
- SafeLocalAllocation.cs
- FilteredDataSetHelper.cs
- TimeoutException.cs
- ImmutablePropertyDescriptorGridEntry.cs
- HttpInputStream.cs
- StringInfo.cs
- SimpleBitVector32.cs
- NumberFunctions.cs
- OneWayBindingElementImporter.cs
- CircleHotSpot.cs
- WebConfigurationFileMap.cs
- EventBuilder.cs
- ImageDrawing.cs
- RenderTargetBitmap.cs
- ResourceReferenceKeyNotFoundException.cs
- EntityKey.cs
- DataGridCellsPanel.cs
- DataViewListener.cs
- XmlEncodedRawTextWriter.cs
- ValidationResults.cs
- CompiledXpathExpr.cs
- LogManagementAsyncResult.cs
- DataControlField.cs
- PenContext.cs
- PhonemeConverter.cs
- DynamicUpdateCommand.cs
- Function.cs
- NavigatorInput.cs
- Matrix.cs
- TraceSwitch.cs
- GenericTypeParameterBuilder.cs