C#
C#
Setting a HTTP Max Response Size
Demonstrates theMaxResponseSize property.
Chilkat C# Downloads
bool success = false;
Chilkat.Http http = new Chilkat.Http();
uint maxSz = 16384;
http.MaxResponseSize = maxSz;
// Try to get something larger, such as hamlet.xml which is 279658 bytes
string xmlStr = http.QuickGetStr("https://chilkatsoft.com/hamlet.xml");
if (http.LastMethodSuccess == false) {
// If the LastErrorText contains the string "MaxResponseSize",
// then the HTTP request failed because the response body would've been larger than the max allowed response size.
Debug.WriteLine(http.LastErrorText);
return;
}
Debug.WriteLine("OK");