Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

<httpWebRequest> Element (Network Settings) 

Customizes Web request parameters.


<httpWebRequest
  maximumResponseHeadersLength="size"
  maximumErrorResponseLength="size"
  maximumUnauthorizedUploadLength="size"
  useUnsafeHeaderParsing="true|false"
/>

The following sections describe attributes, child elements, and parent elements.

Attributes

Attribute Description

maximumResponseHeadersLength

Specifies the maximum length of a response header, in kilobytes. The default is 64. A value of -1 indicates that no size limit will be imposed on the response headers.

maximumErrorResponseLength

Specifies the maximum length of an error response, in kilobytes. The default is 64. A value of -1 indicates that no size limit will be imposed on the error response.

maximumUnauthorizedUploadLength

Specifies the maximum length of an upload in response to an unauthorized error code, in bytes. The default is -1. A value of -1 indicates that no size limit will be imposed on the upload.

useUnsafeHeaderParsing

Specifies whether unsafe header parsing is enabled. The default value is false.

Child Elements

None.

Parent Elements

Element Description

settings

Configures basic network options for the System.Net namespace.

By default, the .NET Framework strictly enforces RFC 2616 for URI parsing. Some server responses may include control characters in prohibited fields, which will cause the System.Net.HttpWebRequest.GetResponse method to throw a WebException. If useUnsafeHeaderParsing is set to true, System.Net.HttpWebRequest.GetResponse will not throw in this case; however, your application will be vulnerable to several forms of URI parsing attacks. The best solution is to change the server so that the response does not include control characters.

This element can be used in the application configuration file or the machine configuration file (Machine.config).

The following code example shows how to specify a larger than normal maximum header length.

<configuration>
  <system.net>
    <settings>
      <httpWebRequest
        maximumResponseHeadersLength="128"
      />
    </settings>
  </system.net>
</configuration>
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.