查找用户的日志报告 [英] to find log report of user

查看:72
本文介绍了查找用户的日志报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨......我是Ibrahim ..,

任何人都可以建议一步一步编写代码来查找用户登录和登出时间来跟踪用户(用户的日志报告)。 。?

解决方案

我在下一个ASP.NET中实现了访问者日志(包括存储用户登录日期,用户注销/超时日期和用户ID) MVC文章: MVC基本站点:第4步 - 使用AJAX在MVC 4.0中进行jqGrid集成, JSON,jQuery,LINQ和序列化 [ ^ ]



步骤如下:

1.设计与<链接的数据库表code>用户数据。在我的解决方案中,用于存储数据的数据库表是: VisitorsLogs



2.要添加逻辑访问和管理上表中的数据。在我的解决方案中,关联的实体类(实体框架部分类)是 VisitorLog



3.要添加通过使用JavaScript在 LogOn 页面和主布局(或母版页)中创建数据条目的用户界面。在我的解决方案中,您可以在 LogOn 视图(来自 Views \Account)和主布局视图中看到 _Layout.cshtml。

  function  onWindowClosing() {
if window .event.clientX< 0 || window .event.clientY< 0 ){

.ajax({
type: POST
url: / Account / OnWindowClosing
});
}
};

function onKeydown(evt){
if (evt! = undefined && evt.altKey&& evt.keyCode == 115 // Alt + F4
{


.ajax( {
类型: POST
url: / Account / OnWindowClosing
});
}
};

window .onbeforeunload = onWindowClosing;
window document .onkeydown = onKeydown;



4.添加用户登录的处理程序和上述步骤的JavaScript中调用的方法。在我的解决方案中,他们在 AcountController 类中方法 LogOn() OnWindowClosing()



5.最后添加管理页面和后面的代码,用于显示和管理来自VisitorLogs表的收集数据。在我的解决方案中,它们由 Views \VistorLog 文件夹中的视图页面和 VisitorLogController 类实现。


Hi... I'm Ibrahim..,
Can anyone suggest step by step to write the code for to find user login and logout time to trace user(log report of user)..?

解决方案

I have implemented the visitor logs (that includes storing the user login date, user logoff/timeout date, and user ID) in my next ASP.NET MVC article: MVC Basic Site: Step 4 – jqGrid Integration in MVC 4.0 using AJAX, JSON, jQuery, LINQ, and Serialization[^]

The steps are:
1.To desing a database table linked with Users data. In my solution the database table used to sores the data is: VisitorsLogs

2.To add the logic of accessing and managing the data from the table above. In my solution the associated entity class (Entity Framework partial class) is VisitorLog .

3.To add the user interface of creating the data entries in your LogOn page and main layout (or master page) by using also JavaScript. In my solution you could see this in LogOn view (from Views\Account) and in the main layout view _Layout.cshtml.

function onWindowClosing() {
            if (window.event.clientX < 0 || window.event.clientY < 0) {


.ajax({ type: "POST", url: "/Account/OnWindowClosing" }); } }; function onKeydown(evt) { if (evt != undefined && evt.altKey && evt.keyCode == 115) //Alt + F4 {


.ajax({ type: "POST", url: "/Account/OnWindowClosing" }); } }; window.onbeforeunload = onWindowClosing; window.document.onkeydown = onKeydown;


4.To add the handler of for the user login and for method invoked in the JavaScript of the step above. In my solution they are in AcountController class the methods LogOn() and OnWindowClosing().

5.And finally to add the admin pages and the code behind for displaying and managing the collecting data from VisitorLogs table. In my solution they are implemented by the view pages from Views\VistorLog folder and by VisitorLogController class.


这篇关于查找用户的日志报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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