Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Other SQL Server 2008 Topics
 SQL Server Membership/audit question

Author  Topic 

psnow85
Starting Member

3 Posts

Posted - 2010-03-31 : 05:28:53
Hi guys,

I have a problem that I have been working on for a few weeks and have posted some info on the asp.net forum. I have been directed to this site since it is purely for SQL Server. I'll post some of my posts below. Cheers for any help/info!



From my previous post:



http://forums.asp.net/t/1525044.aspx



I've been working on some code for an inventory web based application using sql server 2008 express backend. I have some experience writing ASP.NET 2.0 web pages with sql server backends but just have a few questions.


Question 3:

I need to be able to log what users probably using triggers (the users have been set up using the ASP.NET config tools also the roles etc) do e.g When a user performs an action with a INSERT, UPDATE or DELETE command via a button.

What would be the best way to do this?

Would it be better to do this on the web page level (or even if that is possible?) e.g to write the TRIGGER command on the code inside the button? Would this have access to the user name and what field is being updated etc?

Or would it be better to do this on the SQL Server level e.g In the Triggers folder to create a trigger? Although would this way give me access to account names and what has been inserted/updated/deleted?



Right after alot of digging around and trying things out I have managed to get SqlMembershipProvider switched from the ASP.NET config database to the SQL Server table. So now I can create user accounts through the ASP.NET config tool and I can access the data in SQL Server. Thanks to this: http://www.asp.net/(S(ywiyuluxr3qb2dfva1z5lgeg))/learn/videos/video-148.aspx

E.g I used aspnet_regsql.exe to create tables such as dbo.aspnet_Users, dbo.aspnet_WebEvent_Events & dbo.aspnet_Roles etc etc

Since everything is now on the SQL Server would going down the Trigger route be the best since I can now access user names/roles etc in SQL Server along with the data I need to have a history of.


If I wrote a trigger on SQL Server would I be able to "pull" the user name on that sessions purely from the SQL Server? Or can I write a trigger in the ASP.NET code which would have the session information?

psnow85
Starting Member

3 Posts

Posted - 2010-03-31 : 07:11:43
Or can I use the reporting features in SQL Server 2008?

I am not using windows authentication but form authentication. Using SQL Server dbo.aspnet_ tables.
Go to Top of Page

psnow85
Starting Member

3 Posts

Posted - 2010-04-09 : 04:45:35
Some methods of doing this can only be used with "Windows" mode not "Forms" mode. Does any one know a good method?
Go to Top of Page
   

- Advertisement -