查找网站访问者登录的持续时间 [英] Find the duration of the visitor login of a website

查看:205
本文介绍了查找网站访问者登录的持续时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨..
我需要一个代码来查找访客登录网站的持续时间.即使我需要找到持续时间,也没有在页面中使用登录和注销.帮我解决我的问题...

提前谢谢..

问候,

sasikumar
MCAMDOIS

Hi..
I need a code for finding duration of the visitors login in a website. I didn''t use login and logout in my page even though i need to find the duration. Help me for my problem...

Thanks in advance..

Regards,

sasikumar
MCAMDOIS

推荐答案

没有登录/注销功能,您将需要以某种方式标识每个用户以及您在网站上花费的时间.您将无法确定确切的时间,因为您不确定他们何时离开网站.

查看会话对象,并尝试唯一地标识每个用户.一种方法是侦听Session Start事件,并为每个访问者分配唯一的值,可能是在cookie中.您将需要以某种方式将这个唯一值与会话ID相对应地数据库

string sessionId = HttpContext.Current.Session.SessionID;


然后,当会话超时时,计算总持续时间.
With out login/logout functionality, you will need to somehow identify each of your users and time spend in your site. You won''t be able to find exact time as you won''t know for sure when they leave the site.

Look into the session object and try to uniquely identify each user. One way to do this would be to listen to the Session Start event and assign unique value to each visitor, perhaps in cookie. Somehow you will need to database this unique value against the the Session ID

string sessionId = HttpContext.Current.Session.SessionID;


Then when the session timed out, compute the total time duration.


这篇关于查找网站访问者登录的持续时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆