User closing the browser while uploading

G

Guest

I've written a file uploading part of my application using the IHttpModule.
So now, I don't have the memory problem of uploading something big.

Problem:
I can't find which function I have to override, so that I can catch the
event when while user's uploading a file, then suddenly closes the browser.
In that case, couple things happens:
1) ASPNET will start eating up the uploading file on memory instead of on
disk (so picture a hose....water's going into bucket (disk)...then suddenly
you take the bucket away...water gets spilled all over the place (memory))
For some reason, the upload doesn't stop, when the user closes the browser.
2) When the user closes the browser, in my code where I divert the "water"
into the "bucket", the finally section doesn't run at all. Either the
application completely jumped the gun (highly unlikely), or the application
jumped into another higher level method (explaning why the memory hogging on
memory) while childed in my function, so it doesn't "reach" my finally.

Any idea?
 
G

Guest

oops, posted too fast, but I was right on the second case...finally does get
run...at the end...after aspnet finish playing around with eating up memory.

So...is there a way to stop it from continuously working even after the user
closes the browser?

for example if the user uploads a 5 meg file...for some odd reason after I
close the browser on it....it will continue to run and eat up say...300 megs
on aspnet....then when it's done, my finally runs.

but I'm sure after the browser's closed..it's not running inside my
function...because else my file will continue to increase in size...but it
doesn't...
 
B

Bruce Barker

to do this right you should write an isapi filter. a little how asp.net
work.

client browser request ------tcp/ip --> iis --named pipe-->asp.net
worker process
client browser response <-- tcp/ip -- iis <-- named pipe --asp.net
worker process


as iis recieves the upload and it sends the inputstream to the asp.net
worker process (thru a named pipe). Asp.net them stores the input stream in
memory. any refence to the input stream generally create a copy string (used
for parsing).

you want an isapi filter which can redirect the file upload data to a
tempfile and pass the filename(s) onto asp.net in the payload or in a custom
header.

note: if you close the browser it sends a fin to iis. this is perfectly
valid way to mark the end of a post. this was always the case in http 1.0 -
its how a the browser signed the end of the requst -- by closing the pipe.
the webserver just read the input stream until end of file was reached. iis
won't discover the browser is not listening anymore until it tries to send a
response.

-- bruce (sqlwork.com)
 
G

Guest

Can the asp.net httpmodule or the httphandler not handling the browser
closing event?

I really don't want to leave the .net zone and going into something where I
have to write C++ codes. Isn't any of the asp.net functions executed when
the user closes the browser?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top