用户日志应保留在Web应用程序中 [英] User Log should be Maintained in Web Application

查看:132
本文介绍了用户日志应保留在Web应用程序中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友们,

我有一个要求,当用户通过Web中的给定Web表单创建新条目(插入)或任何更改(更新)时,登录Web应用程序的用户应用程序以及他(用户)在Web应用程序中的位置(单击其他菜单链接,更新,插入,以Web格式在Checkbox上进行克隆...简而言之,在Web应用程序中执行任何活动,应保留用户日志中的Looged in user ....将在此时显示用户登录并完成Web应用程序中的活动。

如何在数据库中维护这样的用户Log by Web应用程序,我的后端是SQL Server 2008。



请回复!!!



谢谢,

Aamir

解决方案





我不建议每次用户点击任何活动时使用数据库,而不是你可以使用session。在会话中放置一个数据表或数据集。在数据表中添加3列,如UserID ,UserName和Activity。编写常见功能,在存储在具有用户ID和活动的会话中的此数据表中添加一行。

当用户点击注销时,您可以将会话中的详细信息保存到文本文件中,或者您也可以将完整的数据表发送到存储过程,在那里您可以将日志存储到数据库中并将会话变量设置为null。



查看以下链接,了解如何将数据表传递给存储过程。



将数据表传递给SQL Server 2008中的存储过程 [ ^ ]



将数组或DataTable传递给存储过程 [ ^ ]



http://forums.asp.net/t/1503816.aspx / 1 [ ^ ]



希望它能正常工作。


看看这些,了解如何在您的应用程序中实现日志记录:

Microsoft的企业库 - 日志记录应用程序块 [ ^ ]

使用企业库获取记录 [ ^ ]

如何存储登录数据库使用log4net [ ^ ]



基于错误事件的日志记录很少:

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

获取记录使用企业库 [ ^ ]

使用ASP.NET 2.0进行错误记录 [ ^ ]

错误记录在ASP.NET 中[ ^ ]

Dear Friends,
I have a Requirement in which the user who logs into the Web Application,when Users makes new Entries(Insert) or any Changes(Updates) by Given Web form in the Web Application and where ever he(User) goes in web application like(Clicking on other Menu Link,Updating,Inserting,Cliking on Checkbox in web form..in short perform any activity in web application a User Log should be maintained of that Looged in user....that will show at this time User loggedin and done the activities in web application.
how can i maintain such a user Log by Web application in Database, my backend is SQL Server 2008.

Pls Reply!!!

Thanks,
Aamir

解决方案

Hi,

I wont suggest to use database every time when user clicks on any activity, rather you can make use of session. Place a datatable or dataset in a session. Add 3 columns to datatable like "UserID", "UserName",and "Activity". Write the common fuction which adds a row into this datatable stored in session with user id and activity.
When user clicks on logout, you can save the details from session into a text file or you can also send the complete datatable to stored procedure, there you can store the log into database and make session variable to null.

Check the below links on how to pass datatable to stored procedure.

Passing a datatable to a Stored Procedure in SQL Server 2008[^]

Passing an array or DataTable into a stored procedure[^]

http://forums.asp.net/t/1503816.aspx/1[^]

hope it works.


Have a look at these to learn on how logging can be implemented in your application:
Microsoft's Enterprise Library - Logging Application Block[^]
Get Logging with the Enterprise Library[^]
How to store log in database using log4net[^]

Few with error event based logging:
Create Simple Error Log Files using ASP.NET and C#[^]
Get Logging with the Enterprise Library[^]
Error Logging using ASP.NET 2.0[^]
Error logging in ASP.NET[^]


这篇关于用户日志应保留在Web应用程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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