Security :: Capture The Value Of The Username And Insert In A SQL Server 2008 Database Table
Jun 30, 2010
I am using ASP.Net 4.0/Visual Studio 2010. However, I think it would be the same if it was ASP.Net/VB.Net 3.5. I am inserting three form filed values into a database table. I have placed a LoginName Control on the page and the login name is properly displaying. I am using forms Authentication and it is set up properly in the web config file. I simply want to insert the logged in username value into the database table so I can track who created the records. I am happy to be able to insert the UnserName or the UserID value. I assume both of the values are derived out of the aspnet_Users table. Being able to insert either one would be fine but I believe UserID would be better because it will always be unique.
CDC or Change data capture is a new feature in SQL Server 2008, which is an ability to record changes to table data into another table without writing triggers or some other mechanism, Change data capture records the changes like insert, update, and delete to a table in SQL server.I have sql 2005 and I have created triggers and tables CDC to capture the data. everything functions good and the data is being updated in the _CDC tables. all i need to do now is to generate the updated data as a report (excel/html)- what should I do ......?i need to show only the updated columns when user selects the date periods ( Range between dates ) and the person name - i need to display any updated info about that person during that period. So this updated columns about this person should be displayed in excel formatted column wise.
I have a table setup in the database for users who are basically going to create a classified listing. How can I setup a diagram that would easily create a table relationship with the Users table, so that it automatically inserts the users username when they submit a new ad? If so, how? I've tried adding a UserName row to my table and creating a relationship with the Users table "UserName" row, but it wasn't accepting the relationship when I tried to save the diagram...apparently because the UserName row in the Users table isn't a primary key?
Also, one this is setup, what's the best way to provide the user a way to see a list of their ads and have the ability to edit them?
I have set up security on my ASP.NET site and currently have 1 user (soon to be more!). I would like to send the logged-on user's username to a variable, to input this value to a custom-designed stored procedure on my SQL database (for recording search statistics).Does anyone know how I can harness the current logged-on users username? I am using VB. Will the following achieve the result?session(username)If so, how do I implement this? I tried using "Current_User" in the SQL stored procedure, but obviously this did not record the ASP.NET user. Also, if the current user has not logged onto the site, I would like the "username" value to be "annonymous".
I want to capture when a user logs in and his username. I am using a login control inside a anonymous temp[late of a login view control. on the logedin event of the login I have this code:
Dim log As Login = CType(sender, Login) If Not log.UserName = "email@example.com" Then Dim mil As MailUtility = New MailUtility mil.ClientLogin(log.UserName) End If
but log.username is always empty and so is the page.user.identity.name and the page.user.identity.isauthenticated always returns false this even thouhgt this is the LogedIn event of the login and also I "just loged in" I really did.. is there a way to capture this is the global.asax?
I have an excel sheet that contains around 30,000 rows and 18 colmns. These no of rows and columns may increase in future. I need to read all these records from excel sheet and insert into a table in sql database. For reading the excel book I am using Oledbconnections. The possible solutions I have known as per my knowledge, to insert the data are
1. To insert one record at a time which makes 30,000 database hits. How will this affect the performance? 2. To use liked servers - bu this is not working for me.I do not have database permissions to use linked servers. So, the only option i have is the first one.
I was reading about "Change Data Capture" functionality in SQL Server 2008. It sounds awesome. My implementation of it would be in a website environment where ASP.NET pages use SQLDatasources to do inserts, updates and deletes. When enabling "Change Data Capture" can you store additional information supplied from the website like a UserID, SessionID, UserRole etc so you can identify who did the insert, update or delete? [URL]
I have a CreateUserWizard control to be able to allow an anonymous user to create an account. Provided that all entered information is correct that the user enters, a new account is created for him/her. But also, when this user is created, I want to [b]also[/b] add the username to another table in my ASPNETDB database. How exactly can I "tap" into the event that creates a user and adds it to the appropriate tables (aspnet_Users, Members, etc.) and make it add the username to yet another table?
I have a gridview on a page that allows a user to edit the data. I need to be able to insert the current user's username in the database table whenever they click update on the gridview. I am new to coding and im strugling to get this project done.I am using MSSQL Server 2005 and VB in the codebehind.
The code seems ok, except for events that have no user context associated with them (ie. a user on our public web page). In that case the log4net capture seems to sometime write the last logged in user account (bad) and sometime write a null (good). Anyone got this feature to work reliably in all cases? I believe I saw a note that MDC is no longer a recommended feature to use, but I wasn't able to find any alternatives that are recommended.
Note: I find it odd that MDC is set with an account name, but never cleared if no user is active. That could be part of the problem. However, I didn't find any MDC code extracts that also clear the username.
so I will admit this is a pretty stupid question. To my defense, I have never done it before. So take pity. I followed Joe Stagner's video on using the built-in authentication. Now, I would like to query a database using VB.net codebehind to verify if the user exists. I am clueless. Yes, I have a connection string already.
I am using SQL server triggers to do the database auditing for my website. My problem is that I cannot pass the username who manipulate data into the Audit table. The username saved into Audit table is always the SQL server user name which is part of my connection string. Is there any better way to handle this?
i would like to do a project that enable to capture photo from webcam, and record audio from microphone store to database. but the photo and audio store in folder and the database only store the filename. later i set the path and its play back the audio and show the photo.
i need to insert multiple rows at a time into database table(sqlserver) from datatable or gridview. Actually iam looping through the rows of gridview and inserting each row. Is there any method to insert entire table of rows at a time into database table. Both datatable columns and database table coulmns are similar.