跟踪用户活动的一个asp.net MVC的网站/行动? [英] Track user activity/actions for an asp.net mvc website?

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

问题描述

我想保持一个日志每次网页浏览我的web应用程序的所有用户。有足够的时间过去后,我会再使用该日志来生成报告。我想有记录机制是一个有点灵活,因为我不需要记录每个HTTP请求。

I would like to keep a log of each page view for all users of my web application. After enough time has passed, I will then use that log to generate reports. I would like to have the logging mechanism be a bit flexible since I wouldn't need to log every http request.

一个例子使用案例是:某公司注册了我的web应用程序,并允许5名员工使用的应用程序。我想向大家报告,3名员工在上周使用的应用程序。或显示,4员工使用的是六,当年八月间。

An example use case is: A company signs up for my web app and allows 5 employees to use the application. I would like to report that 3 employees used the application in the last week. Or show that 4 employees used it between June and August of the current year.

我使用asp.net的MVC与SQL Server,如果有差别。

I'm using asp.net mvc with sql server, if that makes a difference.

难道仅仅是这样简单?用户ID,ControllerName,ActionName,ActionParameters,CreatedOn:具有下列列创建SQL表。然后创建一个将记录添加到数据库的调用的每个操作的ActionFilterAttribute。

Is it just as simple as this? Create a sql table with the following columns: UserId, ControllerName, ActionName, ActionParameters, CreatedOn. Then create an ActionFilterAttribute that adds a record to the db for each action invoked.

有没有我应该担心(而不是一个潜在的大表大小)的任何陷阱?

Are there any pitfalls that I should worry about (other than a potentially large table size)?

推荐答案

一些缺陷:


  1. 您将无法做任何服务器级别的页面缓存。

  2. 分贝写很多,因为你实际上是记录每个请求。

  3. 如果有在页面上碰巧你可能会被存储redunant信息的任何行动。

我会假设你会在某些类型的自定义AuthorizeAttribute的实现这个让你不编码它的每一个控制器上,但那么这将是字面上这将可能会超过你的实际需要每一个要求。

I would assume you would implement this in some type of custom AuthorizeAttribute so your not coding it on every controller but then it will be literally every request which would possibly be more than you actually need.

你有没有使用某种类型的IIS日志的分析工具考虑?这将有很多需要已经是信息的。

Have you considered using some type of IIS log parsing utility? It would have a lot of the info you need already.

这篇关于跟踪用户活动的一个asp.net MVC的网站/行动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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