Hi all -
I am developing an ASP.NET (C#) application and need some help. I wish
to call a server-side function (in the code-behind "file.aspx. cs") upon
a user clicking on the "X" to close the browser window. Is there a way
to postback and call a server-side function when this happens? I am
aware of the browser's native "onunload" event, but am not certain that
what I'm looking for is actually possible. Any help would be greatly
appreciated, thanks in advance. 2 5750
M B HONG 20 wrote: I am developing an ASP.NET (C#) application and need some help. I wish to call a server-side function (in the code-behind "file.aspx. cs") upon a user clicking on the "X" to close the browser window. Is there a way to postback and call a server-side function when this happens? I am aware of the browser's native "onunload" event, but am not certain that what I'm looking for is actually possible.
Traditionally the onunload handler has not been a reliable way to get
any communication done with the server. Some browsers (IE since IE 5,
Firefox, newer Mozillas) provide an onbeforeunload handler where you
might have more chances. But that handler brings up a dialog window
asking the browser user to confirm that he wants to navigate away. And
script in that handler cannot check what the user does in the dialog.
And both onunload and onbeforeunload are fired too when links are
followed, form submitted, new URLs loaded after being entered in the
location bar, you cannot precisely distinguish whether some tries to
close a browser window or navigates to a new URL.
--
Martin Honnen http://JavaScript.FAQTs.com/
Martin Honnen wrote: M B HONG 20 wrote: I am developing an ASP.NET (C#) application and need some help. I wish to call a server-side function (in the code-behind "file.aspx. cs") upon a user clicking on the "X" to close the browser window. Is there a way to postback and call a server-side function when this happens? I am aware of the browser's native "onunload" event, but am not certain that what I'm looking for is actually possible. Traditionally the onunload handler has not been a reliable way to get any communication done with the server.
True.
Some browsers (IE since IE 5, Firefox, newer Mozillas) provide an onbeforeunload handler where you might have more chances. But that handler brings up a dialog window asking the browser user to confirm that he wants to navigate away.
AIUI only if a string is returned from the assigned event listener.
<URL:http://msdn.microsoft. com/workshop/author/dhtml/reference/events/onbeforeunload. asp>
<URL:https://bugzilla.mozill a.org/show_bug.cgi?id =68215>
And script in that handler cannot check what the user does in the dialog.
Which would not be necessary if something else or nothing (== undefined)
is returned.
And both onunload and onbeforeunload are fired too when links are followed, form submitted, new URLs loaded after being entered in the location bar, you cannot precisely distinguish whether some tries to close a browser window or navigates to a new URL.
True, however
<URL:http://www.faqts.com/knowledge_base/view.phtml/aid/7733/fid/53>
PointedEars This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: bhennon |
last post by:
Hey all,
I have a small php script that calls a random image at the following
page.
http://www.2006ymcanationals.com/random.php
IT WORKS IF I go directly to the above link.
I am trying to call that in another page so that i get a random image
the page is http://2006ymcanationals.com/index.php using <img
|
by: dw |
last post by:
Hello all, I'm having a dickens of a time calling a stored procedure on a
connection. Every time I do, it generates an error "Arguments are of the
wrong type, are out of acceptable range, or are in conflict with one
another." I've run the same stored procedure with the same exact list of
arguments in Query Analyser in SQL Server, and it works. The page has the
adovbs constants. Note that uspGetProperties is a stored procedure in SQL...
|
by: ZeBerg |
last post by:
Is it possible to have a stored procedure in database A while calling
it from database B and have it manipulate the tables in database B
(whatever the calling database happens to be)?
We have a large-scale app that uses many complex stored procedures,
and as of now, we're copying the SPs to every new database that is
created, and it will soon become a nightmare for propagating updates
and fixes. We'd like to keep a master set of the SPs...
|
by: Vinod |
last post by:
Hi,
I have a problem, i am calling an exe from asp program. Its not working
fine.
When i execute the exe through the dos program directly i get the desired
result.
My exe will convert files in the folder to encrypted files.
But when i call it thru asp program its not working fine. I have tried the
following method.
|
by: Julia |
last post by:
Hi,
I have a windows application which create a singleton remote object
And a net application which call the remote object
both on the same machine(windows 2000,iis 5.0)
here is the code in the webapplication:
try
| |
by: Steve.Goodman |
last post by:
Appologies if this has already been asked, but after scanning the web and
this news group I could find no decent solution.
We have a windows App that calls a webservice, using this bit of basic code.
Dim objPreReq As PDCPreReq.PreReqs
Dim objProxy As System.Net.WebProxy = System.Net.WebProxy.GetDefaultProxy
objProxy.Credentials = System.Net.CredentialCache.DefaultCredentials
|
by: Jack |
last post by:
Hi,
I am trying to run an example code from a book. However I am getting the
following error message:
Number: -2147217900
Description: Syntax error or access violation
Source: Microsoft OLE DB Provider for SQL Server
SQLState: 42000
|
by: RvGrah |
last post by:
If I use a Sql Server 2005 Express copy of a database on my local
machine to develop my apps, can I then just substitute (Ctl+Shift + H
"replace all") the server name of my local machine with the server name
of our company server when I deploy this to my users?
I can't deploy versions calling my local development machine because
other apps talking to this same database are still based on VS 2003 and
some even from VB6, and they all need...
|
by: eighthman11 |
last post by:
I'm calling a stored procedure on a sql server from an access
application. I just need the stored procedure to run I do not need any
data returned from the stored procedure to my Access application but I
do pass parameters from my Access application. What I have works fine
and is attached below. But I have one question. Why do I need this
line of code to execute the stored procedure.
Set rst = qdf.OpenRecordset(dbOpenSnapshot)
Here...
|
by: ambujnema |
last post by:
When I am calling C# dll into Vb6.0 through Server.CreateObject (“ClassLibrary1.Class1”). I stuck at one place; I have to pass some parameter in that class,
Class contain two methods, in which one is taking one parameter, while calling class, I have to send parameter value also.
Please tell me how to pass parameter in Server.CreateObject.
|
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,...
| |
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...
|
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...
|
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...
|
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...
|
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();...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |