mscorlib(4.0.0.0) API with additions
HttpWebRequestElement.cs
2 
4 {
6  public sealed class HttpWebRequestElement : ConfigurationElement
7  {
8  private ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection();
9 
10  private readonly ConfigurationProperty maximumResponseHeadersLength = new ConfigurationProperty("maximumResponseHeadersLength", typeof(int), 64, ConfigurationPropertyOptions.None);
11 
12  private readonly ConfigurationProperty maximumErrorResponseLength = new ConfigurationProperty("maximumErrorResponseLength", typeof(int), 64, ConfigurationPropertyOptions.None);
13 
14  private readonly ConfigurationProperty maximumUnauthorizedUploadLength = new ConfigurationProperty("maximumUnauthorizedUploadLength", typeof(int), -1, ConfigurationPropertyOptions.None);
15 
16  private readonly ConfigurationProperty useUnsafeHeaderParsing = new ConfigurationProperty("useUnsafeHeaderParsing", typeof(bool), false, ConfigurationPropertyOptions.None);
17 
18  protected internal override ConfigurationPropertyCollection Properties
19  {
20  protected get
21  {
22  return properties;
23  }
24  }
25 
28  [ConfigurationProperty("maximumUnauthorizedUploadLength", DefaultValue = -1)]
30  {
31  get
32  {
33  return (int)base[maximumUnauthorizedUploadLength];
34  }
35  set
36  {
37  base[maximumUnauthorizedUploadLength] = value;
38  }
39  }
40 
43  [ConfigurationProperty("maximumErrorResponseLength", DefaultValue = 64)]
45  {
46  get
47  {
48  return (int)base[maximumErrorResponseLength];
49  }
50  set
51  {
52  base[maximumErrorResponseLength] = value;
53  }
54  }
55 
58  [ConfigurationProperty("maximumResponseHeadersLength", DefaultValue = 64)]
60  {
61  get
62  {
63  return (int)base[maximumResponseHeadersLength];
64  }
65  set
66  {
67  base[maximumResponseHeadersLength] = value;
68  }
69  }
70 
73  [ConfigurationProperty("useUnsafeHeaderParsing", DefaultValue = false)]
74  public bool UseUnsafeHeaderParsing
75  {
76  get
77  {
78  return (bool)base[useUnsafeHeaderParsing];
79  }
80  set
81  {
82  base[useUnsafeHeaderParsing] = value;
83  }
84  }
85 
88  {
89  properties.Add(maximumResponseHeadersLength);
90  properties.Add(maximumErrorResponseLength);
91  properties.Add(maximumUnauthorizedUploadLength);
92  properties.Add(useUnsafeHeaderParsing);
93  }
94 
95  protected override void PostDeserialize()
96  {
97  if (base.EvaluationContext.IsMachineLevel)
98  {
99  return;
100  }
101  PropertyInformation[] array = new PropertyInformation[2]
102  {
103  base.ElementInformation.Properties["maximumResponseHeadersLength"],
104  base.ElementInformation.Properties["maximumErrorResponseLength"]
105  };
106  PropertyInformation[] array2 = array;
107  foreach (PropertyInformation propertyInformation in array2)
108  {
109  if (propertyInformation.ValueOrigin == PropertyValueOrigin.SetHere)
110  {
111  try
112  {
113  ExceptionHelper.WebPermissionUnrestricted.Demand();
114  }
115  catch (Exception inner)
116  {
117  throw new ConfigurationErrorsException(SR.GetString("net_config_property_permission", propertyInformation.Name), inner);
118  }
119  }
120  }
121  }
122  }
123 }
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.
Definition: __Canon.cs:3
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.