how to get values of time spent online reguser in asp.net using sql serve

Posted by Dn2010 under ASP.NET on 2/6/2011 | Points: 10 | Views : 1827 | Status : [Member] | Replies : 4
hi friends,

how to get values of time spent online reguser in asp.net using sql server

like this,

Time Spent Online: 3 Days, 5 Hours, 32 Minutes, 23 Seconds

thanks.




Responses

Posted by: SheoNarayan on: 2/6/2011 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
Hi Dn2010,

I am trying to give you an approach, hope this will help you in developing your solution.

Keep two more column for the User table (where you are storing user details) - LoginDateTime and LogoutDateTime (both of DateTime type). When your user is logging in update the LoginDateTime with the current date time and when user is singing out, update LogoutDateTime with the current date time value. At the time of displaying the report, calculate the difference between the LogoutDateTime and LoginDateTime and show it.

Hope this will help you to develop your solution.

Thanks

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Dn2010, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Karthikanbarasan on: 2/8/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
Hi,

As sheo mentioned this will be straight forward approach... Also we can make use of the application obj variable for the session and have the login time also at logout get the time and make the difference..

Thanks
Karthik
www.f5Debug.net

Dn2010, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Naimishforu on: 2/9/2011 [Member] [MVP] Bronze | Points: 25

Up
0
Down
You can make use of Session.

Thanks

Thanks,
Naimish
http://dotnetinterview.zxq.net/
http://naimishpandya.blogspot.in/

Dn2010, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Madhu.b.rokkam on: 2/10/2011 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Hi,

You need to make sure that you handle session out scenario also when using session objects.

Regards
Madhu


Thanks and Regards
Madhu

Dn2010, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response