# Re: URL Processing two gadgets reply how to solve ASP. net file upload size restrictions, we know that by default ASP.. Net file upload size is limited to 2 MB. In general, we can change the web. the config file defines the maximum file size as follows:
<Httpruntime executiontimeout = "300" maxrequestlength = "40960" usefullyqualifiedredirecturl = "false"/> in this way, the maximum value of the uploaded file is 4 MB, however, this does not allow us to infinitely expand the value of maxrequestlength, because ASP. net loads all files into the memory and then processes them. The solution is to use the implicit httpworkerrequest and its getpreloadedentitybody and readentitybody methods to read data from the pipe created by IIS for ASP. NET in blocks. The implementation method is as follows:
Iserviceprovider provider = (iserviceprovider) httpcontext. Current;
Httpworkerrequest wR = (httpworkerrequest) provider. getservice (typeof (httpworkerrequest ));
Byte [] BS = Wr. getpreloadedentitybody ();
.
If (! Wr. isentireentitybodyispreloaded ())
{
INTN = 1024;
Byte [] bs2 = newbyte [N];
While (WR. readentitybody (bs2, n)> 0)
{
..
}
} This solves the problem of uploading large files. Thin comments on
Http://www.cnblogs.com/pw/archive/2006/05/24/408427.html