473,890 Members | 1,903 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Capture the event of closing IE

Hello Everyone,

How can I capture the event of closing the IE browser from within an ASP.NET
web application?

TIA,
Uma
Nov 18 '05 #1
5 4492
The only thing I could think of is using JavaScript to detect the window
closing and then have the JavaScript fire a server side event. I haven't
done this before so I am giving you some ideas. Try looking up now to fire
server side code from JavaScript and then the client side code for javascript
should be pretty easy to find to detect a window closing. Hope this helps

"Uma Muthu" wrote:
Hello Everyone,

How can I capture the event of closing the IE browser from within an ASP.NET
web application?

TIA,
Uma

Nov 18 '05 #2
there is no foolproof method sort of providing your own browser. the browser
does not fire a close event that can be captured. you can get the page
unload, but this fires on every navigation.

-- bruce (sqlwork.com)
"Uma Muthu" <Ma**@NoCoolSpa mBlue.com> wrote in message
news:OV******** ******@tk2msftn gp13.phx.gbl...
| Hello Everyone,
|
| How can I capture the event of closing the IE browser from within an
ASP.NET
| web application?
|
| TIA,
| Uma
|
|
Nov 18 '05 #3
Hi Uma,

Below is a reply I've posted in the past on this topic. Ken.

Hi,

As others have said this is a tricky issue. The odds of you getting a
succesful postback are 50/50 to say the best. I've had about a 95% success
rate doing this:

1. Capture the onbeforeunload event in your body tag.
2. Incorporate the WebService.htc.
3. When the onbeforeunload event fires run a function that uses the
WebService.htc to tell a web service.

The browser will close before you get a response back but, about 95% of the
time, your web service will get hit and the user can successfully be logged
out. Note, that using the latest IE and Windows XP you will achieve almost
100% results. This is sort of complicated until you get the hang of it. If
this isn't something you want to try then here is another suggestion to
improve your chances but it might seem clunky to the user:

Have a main page that the user browses to. To run your app, they click a
button or link and then you use window.open() to create a new browser
window. This is the window your app runs from. Don't ask me why, but the
success rate of a postback from onbeforeunload seems to be much higher for
browsers launched from javascript than from browsers launched by the user.
Good luck! Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

"Uma Muthu" <Ma**@NoCoolSpa mBlue.com> wrote in message
news:OV******** ******@tk2msftn gp13.phx.gbl...
Hello Everyone,

How can I capture the event of closing the IE browser from within an ASP.NET web application?

TIA,
Uma

Nov 18 '05 #4
You may be able to take advantage of the client side OnClose event.
Here's more info:
http://www.mozilla.org/docs/dom/domr...dow_ref56.html

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Uma Muthu" <Ma**@NoCoolSpa mBlue.com> wrote in message
news:OV******** ******@tk2msftn gp13.phx.gbl...
Hello Everyone,

How can I capture the event of closing the IE browser from within an
ASP.NET
web application?

TIA,
Uma

Nov 18 '05 #5
Thanks everyone. I found this one on net ... Very similar to what Ken said
....

http://aspnet.4guysfromrolla.com/articles/101304-1.aspx

-Uma
"Ken Dopierala Jr." <kd*********@wi .rr.com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Hi Uma,

Below is a reply I've posted in the past on this topic. Ken.

Hi,

As others have said this is a tricky issue. The odds of you getting a
succesful postback are 50/50 to say the best. I've had about a 95% success rate doing this:

1. Capture the onbeforeunload event in your body tag.
2. Incorporate the WebService.htc.
3. When the onbeforeunload event fires run a function that uses the
WebService.htc to tell a web service.

The browser will close before you get a response back but, about 95% of the time, your web service will get hit and the user can successfully be logged out. Note, that using the latest IE and Windows XP you will achieve almost 100% results. This is sort of complicated until you get the hang of it. If this isn't something you want to try then here is another suggestion to
improve your chances but it might seem clunky to the user:

Have a main page that the user browses to. To run your app, they click a
button or link and then you use window.open() to create a new browser
window. This is the window your app runs from. Don't ask me why, but the
success rate of a postback from onbeforeunload seems to be much higher for
browsers launched from javascript than from browsers launched by the user.
Good luck! Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

"Uma Muthu" <Ma**@NoCoolSpa mBlue.com> wrote in message
news:OV******** ******@tk2msftn gp13.phx.gbl...
Hello Everyone,

How can I capture the event of closing the IE browser from within an

ASP.NET
web application?

TIA,
Uma


Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
2901
by: Christopher W. Douglas | last post by:
I am writing a VB.NET application in Visual Studio 2003. I have written a method that handles several events, such as closing a form and changing the visible status of a form. I have some code that applies to all these events, but I need to have specific code execute when the form closes. The properties for this method are sender (the originator) and e (event arguments). I know how to get typeof (sender) to determine what form or...
2
8900
by: Derek | last post by:
Hello: I want to capture the event when a browser is closing, to give to the user the posibility of close or no this browser. When the browser is closing, this show a confirm window with two buttons: Accept and Cancel. When press the Accept button, the browser is closing, and when press the Cancel button, the browser isn´t closing. I have tried with the event onunload, but this closes first the browser, and
1
5484
by: KS | last post by:
Is it possible to somehow capture that the user is closing the browser by clicking the X at the top right corner? I want to run a javascript when that happends, if possible.
1
2803
by: Feng | last post by:
Hi, Need help on the following issue. We need to clean up some session specific backend resource when a user ends his session. We have a "Logoff" button on the pages that handles that. But the problem is that sometimes the user still closing their browser window by clicking on the "x" button of the window. This is quite a problem for us because it will leave unreleased resource on the server for an unpredictable period of time,...
5
11077
by: Stan Sainte-Rose | last post by:
Hi, Which event is called when the user click on the close window icon (X) ? I want, when he clicks on this icon, to display a message before closing the form. If he replys by No, I don't want to close the form. Thks for your help Stan
2
1390
by: cj | last post by:
I want when someone clicks the X in the upper right corner of my program for it to run the sub I've put in for the exit item on the main menu (exitMenuItem_click)
4
3015
by: Academic | last post by:
Does it make sense to put this If e.Cancel Then Exit Sub at the beginning of form closing events so if the user cancels the app's exiting in one Closing routine he will not be asked again by another when its form Closing routine is run? I guess what I'm asking is will that work. If one form sets e.cancelled to true will e.cancel be true when the next form receives a closing event?
1
10571
by: karthik juneni | last post by:
Hi all, Iam trying to capture windows closing event (i.e) when the user clicks on the "X" button i want to capture that event and want to update some values in the database.I tried two methods but iam getting problems with the two methods. First,one i tried with function Unload()
2
4966
by: =?Utf-8?B?TG9zdEluTUQ=?= | last post by:
Hi All, I am trying to determine if the user clicked the "x" close button within the controlbox of the form (top right corner - next to minimize and maximize buttons). I am using the datagridview within VB2005. I validate the values in the row when the user leaves the row via the grid's RowValidating event. I want to allow the user to exit the application by clicking the "x".
0
9976
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9814
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10903
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9616
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8006
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7158
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5834
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4659
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4257
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.