473,387 Members | 1,569 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.

Capturing the leaving of a page/http_request

Hi there,

i need to ensure a user does something when they exit an asp.net web page. I
cant put code behind close buttons, because there are a thousand ways they
can exit this page, menu buttons, links etc. Is there any way you can capture
the exiting of a page/the moment the server receives a request to move away
from a particular url ? Page_Unload, although it sounds ideal, actually
doesnt capture the unload of a page, but the moment that load finishes! Has
anyone needed to do this, and if so, how?

I'm working in C#.

many thanks in advance.
Nov 20 '05 #1
1 1398
There's no great solution. The only way is to hook into some javascript
events such as OnBeforeUnload which tend to be IE only.

<body OnBeforeUnload="Cleanup();">

<Script langauge="javascript">
function Cleanup()
{
//do stuff
}
</script>

of course, if you need to do stuff server side, you'll have to have
Cleanup() either launch a small popup which you can then do stuff in
Page_load or use AJax to make an asynch request.

Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"louise raisbeck" <lo************@discussions.microsoft.com> wrote in
message news:DE**********************************@microsof t.com...
Hi there,

i need to ensure a user does something when they exit an asp.net web page.
I
cant put code behind close buttons, because there are a thousand ways they
can exit this page, menu buttons, links etc. Is there any way you can
capture
the exiting of a page/the moment the server receives a request to move
away
from a particular url ? Page_Unload, although it sounds ideal, actually
doesnt capture the unload of a page, but the moment that load finishes!
Has
anyone needed to do this, and if so, how?

I'm working in C#.

many thanks in advance.

Nov 20 '05 #2

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

Similar topics

1
by: doug | last post by:
With http_request, is there a debug mode or a way to see exactly what http_request is sending?
15
by: Tony Gahlinger | last post by:
I'm using my browser (Mozilla/5.0 Linux i686 Gecko/20031007 Firebird/0.7) to do some client-side image processing. I want to capture the sequence of coordinates a user clicks on in xxx.jpg in the...
8
by: Zvonko | last post by:
Hi! Is it possible to capture an event when user leaves the page and execute some code? Not when he closes the window. Any ideas?
10
by: Andrew | last post by:
Hi, I have a messagebox that pops up due to an event. I did it in javascript. ie. alert("Time's up. Assessment Ended"); I want to capture the OK and Cancel events of this alert messagebox. My...
1
by: James Pittman | last post by:
Hi, We have a web application (Docushare) that is protected by Siteminder SSO. I'd like to do an HTTP_Request on it. How do I have my script "log in" through Siteminder so that it can do its...
1
by: nick | last post by:
Is it possible to do the following? (note this is more of a curiosity thing than problem solving :)) var parameters = 'b=3&d=4'; http_request = new ActiveXObject("Msxml2.XMLHTTP");...
6
by: Ed Leafe | last post by:
I've been approached by a local business that has been advised that they need to start capturing and archiving their instant messaging in order to comply with Sarbanes-Oxley. The company is largely...
5
by: sachu | last post by:
Hi Everyone, I want develop the intranet site with seamless authentication. Is there any way to capture only the user name who has logged in the windows machine. Iam using PHP 5.0 MySQL and IIS...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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.