473,387 Members | 1,374 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 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 2606
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

60
by: Fotios | last post by:
Hi guys, I have put together a flexible client-side user agent detector (written in js). I thought that some of you may find it useful. Code is here: http://fotios.cc/software/ua_detect.htm ...
7
by: Joe | last post by:
I have an upload file operation in the web application. UploadForm.asp is the form, and UploadAction.asp is the form processing. //UploadForm.asp <FORM NAME="InputForm"...
2
by: Asit | last post by:
How can i know when user clicks X button of the browser ? I have to write some code when user clicks X button of browser. What is the event for capturing this event ? Help needed ASAP. Asit
1
by: Chirag Malvi | last post by:
hello all, I am developing the web application using ASP.net and VS.2003 IDE. here is the situation which i want to implement. 1) User is browsing some webform. I want to trap this event....
1
by: feng | last post by:
Hi, When user closes a browser window by clicking on the "X" button, I want the server to be noticed (either through postback or calling other ASP pages, etc.) and perform some task...
7
by: wrytat | last post by:
Is there a way to check whether the user has confirmed all his items in a shopping cart when he is closing the browser? Then if he hasn't confirm the items, the system can prompt him to confirm the...
7
by: tarun.kataria | last post by:
Hi All, Is there any way to detect that the user is trying to Xout the browser window instead of hitting a button. Because in my application I want to make it sure that they dont do it either...
6
by: hemant.singh | last post by:
Hi all, I am trying to get a way by which I'll know exactly when user goes out of my site by clicking on close button in browser, So that w/e user click close button in browser, I can send a...
20
by: luqman | last post by:
If user login with the login control in ASP.Net 2005 and then just close the browser and then open the browser again, the login status shows, User still Login? Any idea, how to Logout the User...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.