Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Save settings on exit

Reply
Thread Tools

Save settings on exit

 
 
Jaco Bregman
Guest
Posts: n/a
 
      11-17-2003
Hi all,

I have been trying to save some user settings when my web application
closes, but with little success. What I want to do is start a counter on
startup, and write the total count to a database when the user logs off, or
when the user closes the web browser. My problem is that I can't seem to
catch the 'close web browser' event, to write the counter. I've tried to use
the Session_End handler in global.asax, but that doesn't seem to work.

Any ideas?

Thanks,

Jaco


 
Reply With Quote
 
 
 
 
Munsifali Rashid
Guest
Posts: n/a
 
      11-17-2003
Howdy,

There's no server-side event which fires when the user closes the web
browser. The only way to do this, is to catch when the browser is closed
using client side code, and execute a server side page accordingly.

Hope this helps,

Mun



"Jaco Bregman" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi all,
>
> I have been trying to save some user settings when my web application
> closes, but with little success. What I want to do is start a counter on
> startup, and write the total count to a database when the user logs off,

or
> when the user closes the web browser. My problem is that I can't seem to
> catch the 'close web browser' event, to write the counter. I've tried to

use
> the Session_End handler in global.asax, but that doesn't seem to work.
>
> Any ideas?
>
> Thanks,
>
> Jaco
>
>



 
Reply With Quote
 
 
 
 
Kevin Spencer
Guest
Posts: n/a
 
      11-17-2003
Now, Id' surely like to know how the browser is supposed to send a request
when it is closing. The only reliable way to snag the end of the browser
session is with the Session_OnEnd event.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big Things are made up of
Lots of Little Things.

"Munsifali Rashid" <mun@**RemoveToReply**vefuk.com> wrote in message
news:(E-Mail Removed)...
> Howdy,
>
> There's no server-side event which fires when the user closes the web
> browser. The only way to do this, is to catch when the browser is closed
> using client side code, and execute a server side page accordingly.
>
> Hope this helps,
>
> Mun
>
>
>
> "Jaco Bregman" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi all,
> >
> > I have been trying to save some user settings when my web application
> > closes, but with little success. What I want to do is start a counter on
> > startup, and write the total count to a database when the user logs off,

> or
> > when the user closes the web browser. My problem is that I can't seem to
> > catch the 'close web browser' event, to write the counter. I've tried to

> use
> > the Session_End handler in global.asax, but that doesn't seem to work.
> >
> > Any ideas?
> >
> > Thanks,
> >
> > Jaco
> >
> >

>
>



 
Reply With Quote
 
Munsifali Rashid
Guest
Posts: n/a
 
      11-18-2003
The way I've approached this in the past, is by using the onunload event,
and a global frameset. The global frameset can consist of one frame, which
contains the website. The frameset has an onUnload event handler attached,
to execute a server-side page when the user navigates away from the site (or
closes the browser). Navigating within the site will happen within the
frame, which won't fire the onUnload event.

E.g.

In the head section, we could have the following script:

<script language="javascript">
function window_onunload()
{
window.open("http://www.domain.com/dosomething.aspx");
}
</script>


Our frameset could consist of the following:

<frameset rows="100%" onUnload="window_onunload()">
<frame name="MainFrame" src="default.aspx" marginwidth="0"
marginheight="0" scrolling="auto" frameborder="0">
</frameset>

It's not quite the same as the browser firing an event when it's closing.
However, the above method can be applied to achieve relatively good results.
But, as a precaution, I agree that it's always best to use the Session_OnEnd
event, as this is the only reliable way to catch the end of a session and
the browser being closed down.

Mun




"Kevin Spencer" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Now, Id' surely like to know how the browser is supposed to send a request
> when it is closing. The only reliable way to snag the end of the browser
> session is with the Session_OnEnd event.
>
> --
> HTH,
>
> Kevin Spencer
> Microsoft MVP
> .Net Developer
> http://www.takempis.com
> Big Things are made up of
> Lots of Little Things.



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Settings.settings file with settings for multiple regions donet programmer ASP .Net 3 11-20-2009 03:05 PM
prompt to save on exit - disable prompt on save button Mel ASP .Net 10 02-13-2009 05:32 AM
Exit code of a batch (using exit /B) Joe Smith Java 4 11-08-2006 12:25 PM
Code to Exit Web App and Exit Internet Explorer =?Utf-8?B?U2FuZHk=?= ASP .Net 7 08-05-2005 01:55 AM
exit after process exit ajikoe@gmail.com Python 2 05-31-2005 08:11 PM



Advertisments