且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

列出访问该页面的人员

更新时间:2023-12-02 13:16:34

请参阅我对该问题的评论。除非你进行身份验证,否则你应该理解,不太可能。







如果用户经过身份验证,更有意义。



尽管如此,检测对您网站的访问权限会更好(登录,注销)。想象一下,用户加载另一页不关闭您正在计数的页面。有问题的页面是否留下?您无法检测页面的激活,因为这不是Web应用程序可见的事件。



原则上,您只能检测用户是否尝试关闭页面,处理JavaScript事件 onunload 并使用Ajax向站点发送HTTP请求:

http://www.w3schools.com/jsref/event_onunload.asp [ ^ ]。



-SA
Please see my comments to the question. You should understand, not quite possible, unless you do authentication.



If the user is authenticated, it makes more sense.

Still, it would be much better to detect access to your site (log in, log out). Imagine the user loads another page not closing the page you are counting. Is the page in question left or not? You cannot detect activation of the pages, as this is not an event visible to the Web application.

In principle, you can only detect of the user tries to close the page, handling JavaScript event onunload and sending HTTP request to the site using Ajax:
http://www.w3schools.com/jsref/event_onunload.asp[^].

—SA


请按照以下步骤...



1.确定要跟踪用户的页面

2.了解它应该如何工作的场景

3.你应该知道会话是如何工作的



现在在 Page_Load()您必须检查是否有人通过会话登录您的应用程序..



Please follow below steps...

1. Decide in which pages u want to track users
2. Understand the scenario how it should works
3. U should Know how session works

Now in Page_Load() you have to check is there anyone logged in your application through session..

if (Session["useremail"] != null)
        {
            //code to save user information
        }
        else
        {
            // redirect to login page
        }





这里是会话[useremail]存储登录的用户详细信息。因此,如果此会话存在,请保存用户信息,如emailid,注册号等以及页面名称(保存在数据库或XML文件等中)。您将获得访问特定页面的用户列表。



....



Here Session["useremail"] stores logged in user details. So if this session exists save the user information like emailid, registration no etc along with page name ( save in database or XML file etc. ). You you will get list of users accessing particular pages.

....


如果您想找出谁访问过去的页面,您可以使用LogParser查询IIS Web日志以查看访问该URL的用户。这是可能的,因为您已强制用户登录。 Web日志包含URL和UserID的列。
If you are trying to find out who accesses a page in the past, you can use LogParser to query the IIS Web Logs to see who accessed the URL. This is possible because you have forced the user to login. The Web Logs have columns for both the URL and the UserID.