473,746 Members | 2,215 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Urgent...trappi ng User's Browser closing event....

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. this i am doing
with Session_Onstart .
2) Now when user is exiting i.e. closing the browser window i want to trap
this event and perform some operation. I tried using Session_OnEnd event,but
this event will get generated when time out of the session occurs or when
the session is abandon by the application. hence it is not serving my
purpose.

can any body help me in trapping the user's browser closing event or with
any other options??

thanks in advance

regards
chirag
Nov 17 '05 #1
1 2252
Chirag,

You will need to handle that on the client, not in your server-side ASP.NET
code. ASP.NET operates over HTTP, and HTTP is a connectionless protocol.
Your ASP.NET application has no knowledge whatever of the client machine.
Client-side events such as the browser window closing cannot be handled on
the server.

I'm not aware of a client-side event that will handle the closing of the
browser window, but there may be some in the group who are better versed on
client side code than I am. I don't deal much with client side code in my
position.

Jim Cheshire [MSFT]
Developer Support
ASP.NET
ja******@online .microsoft.com

This post is provided as-is with no warranties and confers no rights.
--------------------
From: "Chirag Malvi" <ch**********@i n.bosch.com>
Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
Subject: Urgent...trappi ng User's Browser closing event....
Date: Tue, 11 Nov 2003 19:04:50 +0530
Organization : RBIN
Lines: 23
Sender: UN*****@173.148 .9.199
Message-ID: <bo**********@n s2.fe.internet. bosch.com>
NNTP-Posting-Host: 173.148.9.199
X-Trace: ns2.fe.internet .bosch.com 1068557695 9853 173.148.9.199 (11 Nov 2003 13:34:55 GMT)X-Complaints-To: us****@internet .bosch.com
NNTP-Posting-Date: 11 Nov 2003 13:34:55 GMT
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MSMail-Priority: Normal
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!new s-out.cwix.com!ne wsfeed.cwix.co
m!newsfeed.icl. net!newsfeed.fj serv.net!feed.n ews.nacamar.de! news.f.de.plusl i
ne.net!news-fra1.dfn.de!new s0.de.colt.net! news1.boschrexr oth.de!news1.fe .int
ernet.bosch.com !not-for-mailXref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.framew ork.aspnet:1900 11
X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet

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. this i am doingwith Session_Onstart .
2) Now when user is exiting i.e. closing the browser window i want to trap
this event and perform some operation. I tried using Session_OnEnd event,butthis event will get generated when time out of the session occurs or when
the session is abandon by the application. hence it is not serving my
purpose.

can any body help me in trapping the user's browser closing event or with
any other options??

thanks in advance

regards
chirag


Nov 17 '05 #2

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

Similar topics

2
1757
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
6
4751
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much appreciated. Thanks in advance
2
2322
by: Paul Steele | last post by:
Some time ago I tracked down the code for detecting the shutdown event within a C# program. I tested it, it worked, and I moved on. However, I just discovered that the code is no longer working, and I'm baffled. I've done some more Google searches and have come up with the same thing. A portion of the code is below. I call the HookSessionEnding routine in the Load event of the main form, but the shutdown event code never fires. I'm baffled....
3
5877
by: =B= | last post by:
Hi all, I was wondering if anyone has had any luck with trapping the <BODY> onUnload() event in ASP.NET? The thing is, I'm writing code for an Intranet site. The code makes a call to a third-party component (think of it as a lock) when the page loads. Now the OK and Cancel server buttons I can handle and use to release the lock as required. But previously in classic ASP I had been trapping the user hitting the close 'x' button by...
3
2641
by: Jason Chu | last post by:
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...
4
6448
by: RSH | last post by:
I am trying to figure out how I can trap the Closing Event that occurs when a user attempts to close the window by clicking on the red"X". I tried this code which I found online but nothing happens. What do I need to do to trap and give the ability to save changes before the window closes? Thanks, Ron
6
3942
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 signal to server. This seems to be achievable with body unload events, but it is little too much, as even if user navigate within my site, this event will be generated, this can be avoided by handling onclick of each link, so that I'll know exactly...
2
1504
by: feltra | last post by:
Hi, The following is from my friend, who has some technical problem at present in accessing the web... I am writing for him... Kindly request your inputs ASAP, as he has some kind of deadline tomorrow. .......................................................................................... I am having an issue with MDI form. I have an MDI form and some Child forms. In order to enable for a choice, I am displaying a message box in...
19
3226
by: zacks | last post by:
I have a .NET 2.0 MDI application where the child form has a Tab Control. Each of the Tab in the Tab Control has a Validating event to handle what it should do when the user changes tabs. But these Validating Events are also fired when either the child form or the main (parent) form Close icon is clicked. And I need for these events to know if they are being invoked because the app (or child window) is being closed. I have set a boolean...
0
8795
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,...
0
9486
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9279
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
9214
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8219
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...
0
6057
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
4827
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3287
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
2759
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.