8 private ConfigurationPropertyCollection properties =
new ConfigurationPropertyCollection();
10 private readonly ConfigurationProperty maximumResponseHeadersLength =
new ConfigurationProperty(
"maximumResponseHeadersLength", typeof(
int), 64, ConfigurationPropertyOptions.None);
12 private readonly ConfigurationProperty maximumErrorResponseLength =
new ConfigurationProperty(
"maximumErrorResponseLength", typeof(
int), 64, ConfigurationPropertyOptions.None);
14 private readonly ConfigurationProperty maximumUnauthorizedUploadLength =
new ConfigurationProperty(
"maximumUnauthorizedUploadLength", typeof(
int), -1, ConfigurationPropertyOptions.None);
16 private readonly ConfigurationProperty useUnsafeHeaderParsing =
new ConfigurationProperty(
"useUnsafeHeaderParsing", typeof(
bool),
false, ConfigurationPropertyOptions.None);
18 protected internal override ConfigurationPropertyCollection Properties
28 [ConfigurationProperty(
"maximumUnauthorizedUploadLength", DefaultValue = -1)]
33 return (
int)base[maximumUnauthorizedUploadLength];
37 base[maximumUnauthorizedUploadLength] = value;
43 [ConfigurationProperty(
"maximumErrorResponseLength", DefaultValue = 64)]
48 return (
int)base[maximumErrorResponseLength];
52 base[maximumErrorResponseLength] = value;
58 [ConfigurationProperty(
"maximumResponseHeadersLength", DefaultValue = 64)]
63 return (
int)base[maximumResponseHeadersLength];
67 base[maximumResponseHeadersLength] = value;
73 [ConfigurationProperty(
"useUnsafeHeaderParsing", DefaultValue =
false)]
78 return (
bool)base[useUnsafeHeaderParsing];
82 base[useUnsafeHeaderParsing] = value;
89 properties.Add(maximumResponseHeadersLength);
90 properties.Add(maximumErrorResponseLength);
91 properties.Add(maximumUnauthorizedUploadLength);
92 properties.Add(useUnsafeHeaderParsing);
95 protected override void PostDeserialize()
97 if (base.EvaluationContext.IsMachineLevel)
101 PropertyInformation[] array =
new PropertyInformation[2]
103 base.ElementInformation.Properties[
"maximumResponseHeadersLength"],
104 base.ElementInformation.Properties[
"maximumErrorResponseLength"]
106 PropertyInformation[] array2 = array;
107 foreach (PropertyInformation propertyInformation
in array2)
109 if (propertyInformation.ValueOrigin == PropertyValueOrigin.SetHere)
113 ExceptionHelper.WebPermissionUnrestricted.Demand();
115 catch (Exception inner)
117 throw new ConfigurationErrorsException(SR.GetString(
"net_config_property_permission", propertyInformation.Name), inner);
Represents the maximum length for response headers. This class cannot be inherited.
HttpWebRequestElement()
Initializes a new instance of the T:System.Net.Configuration.HttpWebRequestElement class.
int MaximumErrorResponseLength
Gets or sets the maximum allowed length of an error response.
int MaximumResponseHeadersLength
Gets or sets the maximum allowed length of the response headers.
bool UseUnsafeHeaderParsing
Setting this property ignores validation errors that occur during HTTP parsing.
int MaximumUnauthorizedUploadLength
Gets or sets the maximum length of an upload in response to an unauthorized error code.