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
- SctClaimSerializer.cs
- WebBrowser.cs
- TransactionContext.cs
- DataStreams.cs
- CompatibleIComparer.cs
- PrintPreviewControl.cs
- LineBreak.cs
- iisPickupDirectory.cs
- SourceFileBuildProvider.cs
- CompiledRegexRunnerFactory.cs
- NamespaceQuery.cs
- XhtmlTextWriter.cs
- DataViewManagerListItemTypeDescriptor.cs
- MsmqTransportSecurity.cs
- HierarchicalDataSourceControl.cs
- ColorTransform.cs
- _Rfc2616CacheValidators.cs
- PixelShader.cs
- CollectionViewGroupInternal.cs
- FormViewActionList.cs
- GenericXmlSecurityTokenAuthenticator.cs
- SystemWebExtensionsSectionGroup.cs
- _UncName.cs
- _ListenerResponseStream.cs
- SchemaManager.cs
- SHA1Managed.cs
- EpmContentDeSerializer.cs
- UserNamePasswordServiceCredential.cs
- EventSinkActivityDesigner.cs
- VisualCollection.cs
- Vector3DCollection.cs
- ColorPalette.cs
- GeneralTransform3D.cs
- Attributes.cs
- CmsUtils.cs
- AuthStoreRoleProvider.cs
- DataList.cs
- ColumnCollection.cs
- NullRuntimeConfig.cs
- ContentIterators.cs
- WebPart.cs
- AddInDeploymentState.cs
- ContextMenuStrip.cs
- FullTextLine.cs
- TriState.cs
- SQLDecimalStorage.cs
- InfoCardUIAgent.cs
- HierarchicalDataSourceIDConverter.cs
- DispatcherProcessingDisabled.cs
- KeySplineConverter.cs
- DataGridViewImageColumn.cs
- PrimitiveOperationFormatter.cs
- XNodeValidator.cs
- Parallel.cs
- TextElementCollection.cs
- ConvertersCollection.cs
- dtdvalidator.cs
- SoundPlayerAction.cs
- EventsTab.cs
- ThumbButtonInfoCollection.cs
- MissingSatelliteAssemblyException.cs
- NamedObject.cs
- NativeMethods.cs
- CodeDOMProvider.cs
- AttributeUsageAttribute.cs
- XsltConvert.cs
- RightsManagementEncryptedStream.cs
- StreamReader.cs
- DataSetUtil.cs
- RecognizerInfo.cs
- ToolboxItem.cs
- XmlSchemaGroup.cs
- TextChangedEventArgs.cs
- SymbolEqualComparer.cs
- Vector3dCollection.cs
- RequestCacheEntry.cs
- Statements.cs
- InteropDesigner.xaml.cs
- DataObjectSettingDataEventArgs.cs
- InputMethod.cs
- DateTimeFormatInfo.cs
- SqlDataSourceCache.cs
- TreeWalker.cs
- EntityDataSourceSelectingEventArgs.cs
- CheckBox.cs
- SqlMethodCallConverter.cs
- TypeForwardedToAttribute.cs
- Italic.cs
- PointAnimationUsingPath.cs
- SecurityKeyIdentifierClause.cs
- DocumentPageTextView.cs
- contentDescriptor.cs
- Lease.cs
- AdRotatorDesigner.cs
- MediaElementAutomationPeer.cs
- DesignerValidationSummaryAdapter.cs
- PathGradientBrush.cs
- mediapermission.cs
- ParamArrayAttribute.cs
- PolygonHotSpot.cs