Click here to Skip to main content
16,020,313 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted

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.
 
Share this answer
 
 
Share this answer
 
Comments
Karthik Harve 23-Jun-12 1:50am    
My 5!. Useful links.
Sergey Alexandrovich Kryukov 11-Jul-12 13:19pm    
Great set of links, my 5.
I referenced this post in this answer:
http://www.codeproject.com/Answers/419651/HTTP-Error-500-0-Internal-Server-Error#answer1

Would you like to add your own answer to this question?
--SA
Sandeep Mewara 12-Jul-12 1:31am    
:)Thanks SA.

Sure, replied it based on what I know regarding it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900