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
- Package.cs
- WebServiceParameterData.cs
- SystemTcpConnection.cs
- XmlException.cs
- ArrayElementGridEntry.cs
- ErrorTableItemStyle.cs
- DataGridTablesFactory.cs
- ProgressBar.cs
- WebBrowserProgressChangedEventHandler.cs
- NestedContainer.cs
- WizardStepBase.cs
- OptimalTextSource.cs
- EdmProperty.cs
- EntityDataSourceSelectedEventArgs.cs
- TreeNodeStyle.cs
- TextSelection.cs
- PropertyPushdownHelper.cs
- FilterQuery.cs
- ReliableInputConnection.cs
- PositiveTimeSpanValidator.cs
- xmlsaver.cs
- RichTextBoxConstants.cs
- Selector.cs
- NativeCompoundFileAPIs.cs
- GestureRecognizer.cs
- Component.cs
- FileDetails.cs
- DispatcherSynchronizationContext.cs
- InfoCardCryptoHelper.cs
- ApplicationDirectoryMembershipCondition.cs
- InteropExecutor.cs
- CodeTypeMember.cs
- Transactions.cs
- EdmFunction.cs
- LocalBuilder.cs
- AQNBuilder.cs
- WsdlBuildProvider.cs
- FillRuleValidation.cs
- PeerCredentialElement.cs
- WebPartsPersonalizationAuthorization.cs
- TextContainerHelper.cs
- StoryFragments.cs
- Membership.cs
- DomainUpDown.cs
- ToolStripSettings.cs
- DataGridViewCellLinkedList.cs
- ForceCopyBuildProvider.cs
- SecurityContext.cs
- TextEffectCollection.cs
- PropertyManager.cs
- RelationshipType.cs
- PropertyDescriptorComparer.cs
- UnknownWrapper.cs
- CompositeDataBoundControl.cs
- XmlSchemaAppInfo.cs
- ClientSettingsStore.cs
- MailMessageEventArgs.cs
- EntityCommandDefinition.cs
- OutOfProcStateClientManager.cs
- TextRunCacheImp.cs
- TypeElement.cs
- PropertyEntry.cs
- COM2Enum.cs
- DataGridColumnReorderingEventArgs.cs
- NameValueFileSectionHandler.cs
- XomlCompilerResults.cs
- XsdDataContractExporter.cs
- SoapProcessingBehavior.cs
- DBSqlParserTable.cs
- Point3DKeyFrameCollection.cs
- DocumentPageViewAutomationPeer.cs
- CallbackValidator.cs
- CounterSampleCalculator.cs
- BoolLiteral.cs
- DbConnectionPoolIdentity.cs
- RayHitTestParameters.cs
- Ipv6Element.cs
- StandardToolWindows.cs
- FlowDocumentScrollViewer.cs
- DbConnectionPoolCounters.cs
- EncoderBestFitFallback.cs
- DefaultTextStoreTextComposition.cs
- DesignerSelectionListAdapter.cs
- KeyManager.cs
- ListControl.cs
- ResourcePool.cs
- ClientConfigurationSystem.cs
- LinearKeyFrames.cs
- OutputCacheModule.cs
- ButtonRenderer.cs
- LogLogRecordHeader.cs
- FamilyCollection.cs
- Slider.cs
- TextServicesProperty.cs
- PrimitiveXmlSerializers.cs
- SimplePropertyEntry.cs
- GB18030Encoding.cs
- ConfigXmlAttribute.cs
- SystemIcons.cs
- EventSetter.cs