471,316 Members | 1,324 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,316 software developers and data experts.

User closing the browser while uploading

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?
Nov 19 '05 #1
3 2511
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...
Nov 19 '05 #2
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)

"Jason Chu" <Ja******@discussions.microsoft.com> wrote in message
news:14**********************************@microsof t.com...
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...

Nov 19 '05 #3
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?
"Bruce Barker" wrote:
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)

"Jason Chu" <Ja******@discussions.microsoft.com> wrote in message
news:14**********************************@microsof t.com...
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...


Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

60 posts views Thread by Fotios | last post: by
1 post views Thread by Chirag Malvi | last post: by
7 posts views Thread by wrytat | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.