MaxBytesToCancel Property

Object: SoftArtisans.FileUp
Syntax: MaxBytesToCancel
Type: Long
Read/Write: Read/Write
Description:

FileUp will abort a file transfer to the server when the size of the transfer reaches the value of MaxBytesToCancel. No data will be written to the server's hard disk, the connection will be terminated, and the browser will display a "Page not found" message.

Setting MaxBytesToCancel may reduce the threat of a DoS (Denial of Service) attack on the server. When an upload size hits MaxBytesToCancel, the connection to the server will be terminated, the ASP page will finish executing, and the ASP thread will be freed.

Each concurrent upload occupies one ASP thread. ASP typically allows simultaneous execution of a maximum of 25 threads per processor. To reduce the risk of a DoS, in addition to setting MaxBytesToCancel, increase the value of ProcessThreadMax, and/or add additional processors.

The unit of MaxBytesToCancel is a byte. The default value of MaxBytesToCancel is 0, that is, the property is disabled by default.

MaxBytesToCancel must be set before any form elements are referenced, which would force the upload request to be cached. Because MaxBytesToCancel must be set before the request is cached, in ASP.NET, this value must be set as a registry key to make the value available to the HttpModule. Please see: FileUp Registry Keys.

Note: MaxBytesToCancel is available with IIS4 or higher.

Note: When using the HttpModule with an ASP.NET upload, use the MaxBytesToCancel registry key instead of this property. Since the HttpModule is used for caching, this property will not affect the uploaded file.

For discussion and code samples on limiting the upload size, please see:

See also, MaxBytes.

Examples:
ASP <%
fileUpload.MaxBytesToCancel = 50000000
%>
ASP.NET N/A - Use MaxBytesToCancel registry key.

Copyright © 2010 SoftArtisans, Inc. All rights reserved.