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
- CoreChannel.cs
- DataGridCommandEventArgs.cs
- UpDownEvent.cs
- PersianCalendar.cs
- BitmapMetadataEnumerator.cs
- BidOverLoads.cs
- PartialToken.cs
- ColumnMap.cs
- GeneralTransform3DGroup.cs
- ProcessProtocolHandler.cs
- XmlNodeChangedEventArgs.cs
- VariableModifiersHelper.cs
- UpdatePanelTrigger.cs
- ParseHttpDate.cs
- ProfileGroupSettings.cs
- RegexNode.cs
- TraceSwitch.cs
- EnumerableRowCollectionExtensions.cs
- AdjustableArrowCap.cs
- Window.cs
- CfgParser.cs
- COM2TypeInfoProcessor.cs
- PermissionSetTriple.cs
- HttpHandlersSection.cs
- RegistrationServices.cs
- CategoryNameCollection.cs
- UserControlBuildProvider.cs
- MD5.cs
- KeyboardNavigation.cs
- XpsInterleavingPolicy.cs
- DbConnectionStringCommon.cs
- CornerRadiusConverter.cs
- RequestResponse.cs
- UrlAuthFailedErrorFormatter.cs
- ObjectCacheHost.cs
- CommandField.cs
- PartialCachingControl.cs
- NullableLongMinMaxAggregationOperator.cs
- BamlVersionHeader.cs
- DictionaryEntry.cs
- ISO2022Encoding.cs
- MenuItemBindingCollection.cs
- LinqDataSourceStatusEventArgs.cs
- SecurityTokenRequirement.cs
- Int32KeyFrameCollection.cs
- ApplicationContext.cs
- KeyboardEventArgs.cs
- Pointer.cs
- SqlTransaction.cs
- AttachInfo.cs
- QueryExpr.cs
- ValidationPropertyAttribute.cs
- TextSimpleMarkerProperties.cs
- BufferedOutputStream.cs
- UriScheme.cs
- HtmlInputReset.cs
- ToolStripScrollButton.cs
- AffineTransform3D.cs
- DocumentSignatureManager.cs
- CodeGenHelper.cs
- BigInt.cs
- HashHelper.cs
- XmlNullResolver.cs
- WhitespaceRuleReader.cs
- IsolatedStorageFile.cs
- ComplexBindingPropertiesAttribute.cs
- Transform.cs
- AttachInfo.cs
- PageContentAsyncResult.cs
- Column.cs
- SafeBitVector32.cs
- Crc32.cs
- DataGridViewElement.cs
- MemoryMappedFile.cs
- BufferModesCollection.cs
- AudienceUriMode.cs
- VisualCollection.cs
- QueryCacheKey.cs
- webbrowsersite.cs
- SchemaElementLookUpTableEnumerator.cs
- ObjectDataSourceMethodEditor.cs
- Material.cs
- QilSortKey.cs
- QilReference.cs
- DataRow.cs
- BinaryMethodMessage.cs
- Wildcard.cs
- OrderedHashRepartitionStream.cs
- WorkerRequest.cs
- ModulesEntry.cs
- ClientSponsor.cs
- ScrollableControl.cs
- ConfigurationElementCollection.cs
- _LoggingObject.cs
- PassportAuthenticationEventArgs.cs
- EmptyReadOnlyDictionaryInternal.cs
- Transform3DGroup.cs
- SafeMILHandle.cs
- CompilerWrapper.cs
- DBConnectionString.cs