用户活动登录asp.net [英] User Activity Log in asp.net

查看:70
本文介绍了用户活动登录asp.net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种简单的方法来跟踪启用asp.net会员资格的网站的用户活动。我想看看谁在访问哪些页面以及何时,每个页面的总访问量等等。



有没有任何开放的免费解决方案或一个很好的例子?

解决方案

这些链接应该为您提供一些您可以考虑的想法 -

ASP.NET中的活动记录和错误记录 [ ^ ]

使用ASP.NET和C#创建简单错误日志文件 [ ^ ]

http://weblogs.asp.net/scottgu/archive/2006/05/08/Two-Nice-ASP.NET-Tracing-and-Logging-Articles.aspx [ ^ ]


请参考以下主题:



跟踪Web应用程序中的用户活动:追踪用户活动 [ ^ ]

ASP.Net数据库中的用户活动跟踪 [ ^ ]



..并参考我对类似问题的回答:

如何存储数据历史更改 [ ^ ]


是。

您可以存储所有用户日志详细信息,即登录和退出的时间。

但是你会在登录时将用户名和用户ID存储在会话中。

创建一个名为user-log-details的表格,你可以在这里存储

用户名,

session-Id,

浏览器名称,

登录时间和

退出时间。



保存登录时的所有细节,并在SignOut时更新退出时间。



例如,您可以通过以下代码跟踪浏览器名称和IP地址..



字符串浏览器;





浏览器=(HttpCon text.Current.Request.UserAgent.ToString()。包含(Chrome))? Chrome:HttpContext.Current.Request.Browser.Browser.ToString();





browser =((browser == Chrome)||(浏览器==AppleMAC-Safari))?浏览器:浏览器+ - + HttpContext.Current.Request.Browser.Version.ToString();

visitorIP = HttpContext.Current.Request.UserHostAddress.ToString();

I am looking for a simple way to track user activity of an asp.net membership enabled site. I would like to see who is accessing what pages and when, total visits for each page, etc.

Are there any open free solutions out there or a good example?

解决方案

These links should give you some ideas that you could consider -
Activity logging and Error logging in ASP.NET[^]
Create Simple Error Log Files using ASP.NET and C#[^]
http://weblogs.asp.net/scottgu/archive/2006/05/08/Two-Nice-ASP.NET-Tracing-and-Logging-Articles.aspx[^]


Please refer following threads:

Tracking user activity in web applications:Tracking User Activity[^]
ASP.Net User activity tracking in database[^]

..and refer my answer to similar question:
how to store history of data changes[^]


yes.
you can store all the user log details,i.e at what time there logging in and out.
however you will store the username and userid in session while SignIn.
create a table named user-log-details, where you can store
username,
session-Id,
browser name,
login-time and
logout-time.

save all the details while login-time and update the logout-time while SignOut.

for example,you can track the browser-name and IP-address by the following code..

string browser;


browser = (HttpContext.Current.Request.UserAgent.ToString().Contains("Chrome")) ? "Chrome" : HttpContext.Current.Request.Browser.Browser.ToString();


browser = ((browser == "Chrome") || (browser == "AppleMAC-Safari")) ? browser : browser + "-" + HttpContext.Current.Request.Browser.Version.ToString();
visitorIP = HttpContext.Current.Request.UserHostAddress.ToString();


这篇关于用户活动登录asp.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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