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
- DataGridTemplateColumn.cs
- StylusButtonCollection.cs
- ToolStripGripRenderEventArgs.cs
- RemotingSurrogateSelector.cs
- Parameter.cs
- WebConfigurationFileMap.cs
- X509AsymmetricSecurityKey.cs
- SystemInfo.cs
- LinqToSqlWrapper.cs
- HotCommands.cs
- NameValueSectionHandler.cs
- TextEditorCharacters.cs
- HtmlTableRow.cs
- BaseCodeDomTreeGenerator.cs
- ImageCodecInfo.cs
- CodeDirectionExpression.cs
- IPAddress.cs
- ListGeneralPage.cs
- DependencyPropertyKind.cs
- CodeTryCatchFinallyStatement.cs
- TimeIntervalCollection.cs
- MonthCalendarDesigner.cs
- TextEditorMouse.cs
- EditingContext.cs
- DiscoveryClientChannelFactory.cs
- StringWriter.cs
- NetTcpBindingCollectionElement.cs
- ButtonBaseAdapter.cs
- xmlformatgeneratorstatics.cs
- BindingList.cs
- WorkflowTerminatedException.cs
- GZipUtils.cs
- HandleDictionary.cs
- ExpressionHelper.cs
- ReflectionUtil.cs
- TemplateKey.cs
- NamedObject.cs
- WizardStepBase.cs
- WebException.cs
- HtmlElement.cs
- CodeDefaultValueExpression.cs
- SerializerWriterEventHandlers.cs
- NavigatingCancelEventArgs.cs
- NativeMethods.cs
- InputQueueChannelAcceptor.cs
- DataSourceListEditor.cs
- SizeLimitedCache.cs
- XPathSingletonIterator.cs
- Timeline.cs
- EmulateRecognizeCompletedEventArgs.cs
- ObservableCollection.cs
- ManagementInstaller.cs
- ResolveResponseInfo.cs
- UriExt.cs
- CapiNative.cs
- SessionEndedEventArgs.cs
- WaitHandleCannotBeOpenedException.cs
- InstanceHandleReference.cs
- complextypematerializer.cs
- ManagementEventWatcher.cs
- Stackframe.cs
- ExpandSegment.cs
- CodeNamespaceImport.cs
- WaitHandle.cs
- SystemNetHelpers.cs
- ResourceReferenceExpression.cs
- FrameworkContentElementAutomationPeer.cs
- UInt16Storage.cs
- Executor.cs
- ListItem.cs
- TypeDescriptorFilterService.cs
- initElementDictionary.cs
- ProxyGenerationError.cs
- Pen.cs
- RootBrowserWindow.cs
- M3DUtil.cs
- LogReservationCollection.cs
- EntityDataSourceDesignerHelper.cs
- WebFaultClientMessageInspector.cs
- _NegotiateClient.cs
- LineBreakRecord.cs
- MappedMetaModel.cs
- ValidationError.cs
- ClockController.cs
- XmlSchemaType.cs
- HashSet.cs
- EntityViewGenerationAttribute.cs
- XD.cs
- PositiveTimeSpanValidator.cs
- ProtocolsConfigurationEntry.cs
- ServiceProviders.cs
- XMLSyntaxException.cs
- uribuilder.cs
- VarRemapper.cs
- oledbmetadatacollectionnames.cs
- DataGridViewCellStyleBuilderDialog.cs
- Vertex.cs
- ByteConverter.cs
- Utils.cs
- ClientProxyGenerator.cs