Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- ReadOnlyHierarchicalDataSourceView.cs
- HtmlTable.cs
- RegexStringValidator.cs
- DefaultValueAttribute.cs
- SettingsBindableAttribute.cs
- MouseBinding.cs
- IdentitySection.cs
- TextTreeUndo.cs
- TraceShell.cs
- OdbcInfoMessageEvent.cs
- MeasurementDCInfo.cs
- NullableConverter.cs
- Operator.cs
- XmlAttributeOverrides.cs
- ExecutedRoutedEventArgs.cs
- RecordManager.cs
- ControlSerializer.cs
- PolyLineSegmentFigureLogic.cs
- DataRecordInfo.cs
- IndexedGlyphRun.cs
- LinearGradientBrush.cs
- _ServiceNameStore.cs
- XmlElementAttribute.cs
- DataGridViewDataConnection.cs
- exports.cs
- XmlCharCheckingReader.cs
- BitmapMetadataEnumerator.cs
- AnnotationService.cs
- SqlWriter.cs
- ImmutableCollection.cs
- AsymmetricSignatureDeformatter.cs
- Rotation3DAnimation.cs
- SamlAdvice.cs
- XmlDocumentType.cs
- ValidatorCollection.cs
- SQLDecimalStorage.cs
- Propagator.Evaluator.cs
- CompatibleIComparer.cs
- HighlightVisual.cs
- PreservationFileReader.cs
- BindingMemberInfo.cs
- PersonalizationAdministration.cs
- PersonalizablePropertyEntry.cs
- ConfigXmlText.cs
- SoapException.cs
- EmptyEnumerable.cs
- GatewayDefinition.cs
- ListBindingConverter.cs
- SmtpMail.cs
- XmlSerializationWriter.cs
- CancelEventArgs.cs
- Function.cs
- SqlTrackingQuery.cs
- XmlKeywords.cs
- HttpListenerTimeoutManager.cs
- WebPartConnection.cs
- UdpChannelListener.cs
- PropertySourceInfo.cs
- TargetInvocationException.cs
- CompilerGlobalScopeAttribute.cs
- BufferBuilder.cs
- WinEventHandler.cs
- Simplifier.cs
- _Win32.cs
- DeploymentSection.cs
- BinaryMessageFormatter.cs
- CodeConditionStatement.cs
- objectresult_tresulttype.cs
- DataGridViewRowStateChangedEventArgs.cs
- SQLBytesStorage.cs
- SectionUpdates.cs
- BuildManager.cs
- cache.cs
- WebServiceData.cs
- SuppressMergeCheckAttribute.cs
- UnsafeNativeMethods.cs
- PerformanceCounterCategory.cs
- AsymmetricSecurityProtocol.cs
- PersonalizationStateInfo.cs
- HttpGetClientProtocol.cs
- UserInitiatedNavigationPermission.cs
- HtmlControlPersistable.cs
- AssemblyCollection.cs
- HwndSourceKeyboardInputSite.cs
- LinqDataSourceContextEventArgs.cs
- XComponentModel.cs
- OverflowException.cs
- InstanceDataCollection.cs
- ResourceType.cs
- RotateTransform.cs
- AccessViolationException.cs
- BamlCollectionHolder.cs
- XamlParser.cs
- UpdateTracker.cs
- ObjectSecurity.cs
- RegexNode.cs
- FrameworkContentElement.cs
- Ppl.cs
- CodeLinePragma.cs
- ContainerParagraph.cs