查找用户的日志报告 [英] to find log report of user
问题描述
嗨......我是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 withUsers
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) isVisitorLog
.
3.To add the user interface of creating the data entries in yourLogOn
page and main layout (or master page) by using also JavaScript. In my solution you could see this inLogOn
view (fromViews\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 inAcountController
class the methodsLogOn()
andOnWindowClosing()
.
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 fromViews\VistorLog
folder and byVisitorLogController
class.
这篇关于查找用户的日志报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!