Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 20th, 2006, 01:21 AM
Registered User
 
Join Date: Jul 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default HOW TO CLOSED BUTTON x IN TOP CORNER

Hi,
      I using asp and sql server.I can stored in database in logout time and login status .
but when i closed browser then session was not expire.
and second thing is i can set session is 20 min when after 20 mins session will be expire.
but not updated logout time and status .

it show Logout time and status is "on"

.how can when i closed browser that time logout time and status is off.


I give query


Set con = Server.CreateObject("ADODB.Connection")
 con.open "intatanet"
 qq2 = "UPDATE LoginHistory SET LoginHistoryOutTime='"& now() &"',LoginHistoryStatus='N' Where LoginHistoryStatus='Y' and LoginHistorySessionID = " & Session.SessionID & " "
 'Response.Write qq2
 'Response.End
 Set rs=con.Execute(qq2)


this query is run propery when i logout in logout button. but when i closed browser then cant update logout time and staus.

how can do this.please help me asap.

thanks

 
Old July 24th, 2006, 10:04 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

In your global.asax file you have a method: Session_End I would suggest placing the above code in that method so that when the session terminates, it will fire that query.

"The one language all programmers understand is profanity."
 
Old July 25th, 2006, 01:55 AM
Registered User
 
Join Date: Jul 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

HI,

    I did it,but it cant work.How can update database and how.

pls help me again.

 
Old July 25th, 2006, 06:46 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

It does work, but you actually have to wait for the session to expire on the server; what i mean is that if i were to navigate to your page login and look around then just close the browser window, the Session_End event will eventually fire, after my session has timed out. (By default this is 15 mins)

You are probably going to have to write a Javascript that watches for the page to be closed and if it detects that, it is going to have to call a server side method to fire your query.

"The one language all programmers understand is profanity."
 
Old July 26th, 2006, 03:19 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

If you are using IE, then look up the OnBeforUnload event:

http://www.webreference.com/dhtml/di.../bunload3.html

It is for IE 4 and up only.

 
Old June 20th, 2007, 04:46 AM
Registered User
 
Join Date: Jun 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by dayash_r_prasad
 Hi,
     I using asp and sql server.I can stored in database in logout time and login status .
but when i closed browser then session was not expire.
and second thing is i can set session is 20 min when after 20 mins session will be expire.
but not updated logout time and status .

it show Logout time and status is "on"

.how can when i closed browser that time logout time and status is off.


I give query


Set con = Server.CreateObject("ADODB.Connection")
con.open "intatanet"
qq2 = "UPDATE LoginHistory SET LoginHistoryOutTime='"& now() &"',LoginHistoryStatus='N' Where LoginHistoryStatus='Y' and LoginHistorySessionID = " & Session.SessionID & " "
'Response.Write qq2
'Response.End
Set rs=con.Execute(qq2)


this query is run propery when i logout in logout button. but when i closed browser then cant update logout time and staus.

how can do this.please help me asap.

thanks


Hi,

I have the same problem I have to update the field in the database whenever the browser is closed. My application is in asp.net 2.0.

Did ur problem get solved....

If yes?

Please help me out ...

Thanks in Advance
Bhanu






Similar Threads
Thread Thread Starter Forum Replies Last Post
<b> tag for getting a rounded corner table? Cyber Shiva HTML Code Clinic 1 March 13th, 2007 05:23 AM
Object is closed. Why? myself Classic ASP Basics 2 July 10th, 2006 06:16 PM
Repositioning Top Left Corner of a Page in print dontknowmuch Java GUI 0 September 30th, 2005 12:05 PM
SELECT TOP n NOT SELECTING TOP n! ibi SQL Language 8 March 30th, 2005 08:08 PM
IE closed mail2pravesh General .NET 1 December 10th, 2004 07:09 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.