Last post Jul 14, 2011 05:32 AM by Jai B
Sep 09, 2003 01:28 PM|dannyboy78|LINK
If hwr.HasEntityBody Then fileLen = CType(hwr.GetKnownRequestHeader(HttpWorkerRequest.HeaderContentLength), Integer) progress.bytesTotal = fileLen buffer = hwr.GetPreloadedEntityBody fStream.Write(buffer, 0, buffer.Length) recieved = buffer.Length totalLen
+= recieved progress.bytesReceived = totalLen If Not hwr.IsEntireEntityBodyIsPreloaded Then ReDim buffer(buffsize) bytesRemaining = fileLen - recieved While bytesRemaining >= buffer.Length recieved = hwr.ReadEntityBody(buffer, buffer.Length) fStream.Write(buffer,
0, recieved) totalLen += recieved progress.bytesReceived = totalLen End While recieved = hwr.ReadEntityBody(buffer, (fileLen - totalLen)) fStream.Write(buffer, 0, recieved) totalLen += recieved progress.bytesReceived = totalLen End If
Sep 24, 2003 01:56 AM|BrianJ|LINK
Aug 27, 2009 06:33 AM|Russc|LINK
I know this is an old thread, but I've had this problem very recently and wanted to help anyone else who finds this in Google.
The problem was that we have code similar to the above in a C# HttpHandler. It worked fine on its own, but when I attempted to integrate my Uploader into our product it stopped working.
The problem in our case was that a HttpModule was requesting a parameter from the HttpContext.request object and this was causing ASP.Net to process the request, uploading the file in the process, before my Upload code had even been hit.
This causes the EntityBody to get cleared out, and 'by the way' negated the whole purpose of the Uploader! We made a case so that it wouldn't request this variable if the request was for the Upload HttpHandler, and it started working straight away.
Jul 14, 2011 05:32 AM|Jai B|LINK
I second this. Have just wasted an hour with an httpmodule that used to work and wasn't during debugging. The reason: I hadn't noticed context.Request.Files was in the debug watch window from a previous debug session!
Worth noting that it seems fine to access some Request properties such as Headers, ContentLength etc.