<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.
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.
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.
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.
Specifies whether unsafe header parsing is enabled. The default value is false.
Configures basic network options for thenamespace.
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 themethod to throw a . 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.
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>