Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- CLSCompliantAttribute.cs
- TypeDescriptionProvider.cs
- MatcherBuilder.cs
- EventEntry.cs
- ActivityCodeDomSerializationManager.cs
- GeneralTransform3D.cs
- WeakReferenceList.cs
- FileDataSourceCache.cs
- FirewallWrapper.cs
- TCEAdapterGenerator.cs
- SetMemberBinder.cs
- HMACSHA256.cs
- IndexedString.cs
- RadioButtonBaseAdapter.cs
- StoreAnnotationsMap.cs
- TextEditorTables.cs
- SecurityElement.cs
- odbcmetadatafactory.cs
- TypeUsageBuilder.cs
- TraceFilter.cs
- IDReferencePropertyAttribute.cs
- AdornedElementPlaceholder.cs
- HMACSHA384.cs
- PreservationFileReader.cs
- ServiceReference.cs
- CodeAccessSecurityEngine.cs
- ObjRef.cs
- ImageDrawing.cs
- EdmItemError.cs
- ArglessEventHandlerProxy.cs
- CommonDialog.cs
- ExpressionConverter.cs
- CompilerCollection.cs
- XmlTextEncoder.cs
- DataGridTablesFactory.cs
- TextSelectionHighlightLayer.cs
- HwndStylusInputProvider.cs
- DesignRelationCollection.cs
- SecurityUtils.cs
- MetadataCache.cs
- IDQuery.cs
- Span.cs
- TypeConverterAttribute.cs
- PointCollection.cs
- ChangePassword.cs
- NativeObjectSecurity.cs
- Rectangle.cs
- ServiceHttpModule.cs
- RtfToXamlReader.cs
- Crc32Helper.cs
- CodeSnippetCompileUnit.cs
- SchemaInfo.cs
- SerialPort.cs
- XmlComplianceUtil.cs
- MetaDataInfo.cs
- HashHelper.cs
- RightsManagementEncryptionTransform.cs
- TraceContext.cs
- Query.cs
- NativeMethods.cs
- Missing.cs
- SHA1.cs
- GeneratedContractType.cs
- ActivationWorker.cs
- EntityContainerEntitySetDefiningQuery.cs
- ExpressionEditorAttribute.cs
- DbDataSourceEnumerator.cs
- RayHitTestParameters.cs
- HtmlInputHidden.cs
- ProcessManager.cs
- Encoder.cs
- StagingAreaInputItem.cs
- HtmlTableRow.cs
- ConfigurationCollectionAttribute.cs
- NullReferenceException.cs
- OleAutBinder.cs
- CompareInfo.cs
- QualificationDataItem.cs
- LockedAssemblyCache.cs
- LogRestartAreaEnumerator.cs
- SystemIPAddressInformation.cs
- LoginCancelEventArgs.cs
- newinstructionaction.cs
- diagnosticsswitches.cs
- RectangleGeometry.cs
- BaseParser.cs
- KeyGestureValueSerializer.cs
- EdmRelationshipRoleAttribute.cs
- ListViewItemSelectionChangedEvent.cs
- ObjectStateEntryOriginalDbUpdatableDataRecord.cs
- ClusterUtils.cs
- SafeReversePInvokeHandle.cs
- Help.cs
- InputLangChangeRequestEvent.cs
- CatalogPart.cs
- TableHeaderCell.cs
- BamlTreeNode.cs
- FixUp.cs
- ColorAnimationBase.cs
- ConfigurationSectionGroupCollection.cs