查找网站访问者登录的持续时间

编程入门 行业动态 更新时间:2024-10-24 00:16:59
本文介绍了查找网站访问者登录的持续时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

嗨.. 我需要一个代码来查找访客登录网站的持续时间.即使我需要找到持续时间,也没有在页面中使用登录和注销.帮我解决我的问题... 提前谢谢.. 问候, 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.

更多推荐

查找网站访问者登录的持续时间

本文发布于:2023-10-27 15:38:40,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1533805.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:访问者   持续时间   网站

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!