Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Net / System / Net / Configuration / HttpWebRequestElement.cs / 1305376 / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ReflectionPermission.cs
- NavigatorInput.cs
- SafeNativeMethods.cs
- MethodToken.cs
- AggregateNode.cs
- WorkflowExecutor.cs
- MetabaseServerConfig.cs
- cookiecollection.cs
- WpfKnownTypeInvoker.cs
- ServerType.cs
- CanonicalFormWriter.cs
- Matrix3D.cs
- ByeMessageApril2005.cs
- Win32MouseDevice.cs
- ThrowHelper.cs
- StateBag.cs
- OutOfMemoryException.cs
- BaseServiceProvider.cs
- Brush.cs
- DataGridViewSelectedCellCollection.cs
- Grid.cs
- SqlBuilder.cs
- ImpersonateTokenRef.cs
- MouseCaptureWithinProperty.cs
- UInt64.cs
- InitializingNewItemEventArgs.cs
- InputBinder.cs
- CodeMethodReturnStatement.cs
- WebPartConnectVerb.cs
- Baml2006KeyRecord.cs
- ResourceIDHelper.cs
- SqlNamer.cs
- XmlResolver.cs
- StorageInfo.cs
- DataViewListener.cs
- ServiceDescriptionData.cs
- WindowsComboBox.cs
- PartitionResolver.cs
- ExpressionBuilderContext.cs
- URLIdentityPermission.cs
- FacetEnabledSchemaElement.cs
- InitializationEventAttribute.cs
- contentDescriptor.cs
- KeyMatchBuilder.cs
- ClassDataContract.cs
- CallContext.cs
- InputScopeAttribute.cs
- InternalResources.cs
- CompilerGlobalScopeAttribute.cs
- PropertyTab.cs
- CubicEase.cs
- SelectionPatternIdentifiers.cs
- ExpressionBindingCollection.cs
- SafeBitVector32.cs
- _StreamFramer.cs
- DetailsViewDeleteEventArgs.cs
- RoleGroup.cs
- DigestComparer.cs
- WebPartTransformer.cs
- HttpListenerRequest.cs
- WizardForm.cs
- mil_commands.cs
- DataGridColumnCollectionEditor.cs
- JsonReaderDelegator.cs
- CreateUserWizard.cs
- ScrollBarAutomationPeer.cs
- HwndTarget.cs
- ACE.cs
- AuthenticationManager.cs
- ModelPropertyDescriptor.cs
- FigureHelper.cs
- ClientScriptItemCollection.cs
- InputProviderSite.cs
- RsaSecurityToken.cs
- WebPart.cs
- DataGridViewCellStateChangedEventArgs.cs
- MenuEventArgs.cs
- Tile.cs
- MatrixAnimationUsingKeyFrames.cs
- FontCacheUtil.cs
- GAC.cs
- FrameworkElementAutomationPeer.cs
- DbConnectionClosed.cs
- ParsedRoute.cs
- SecurityValidationBehavior.cs
- SamlDelegatingWriter.cs
- Graphics.cs
- CompiledAction.cs
- ThaiBuddhistCalendar.cs
- DetailsViewRowCollection.cs
- PropertyFilterAttribute.cs
- UrlRoutingHandler.cs
- ConstrainedDataObject.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- BooleanFunctions.cs
- StylusButtonEventArgs.cs
- LinearKeyFrames.cs
- EditingCoordinator.cs
- ConnectionPointCookie.cs
- VectorValueSerializer.cs