I'm making a website, where I'm using the asp.net web administration tool.
When a user logs in, they can see a basic gridview with checkboxes which pulls data from a sql database. Nothing fancy.
Now what I want to do, is save the ID of the logged in user aforementioned sql database.
Scenario: a user checks of some records in the gridview, hits a save button, and those records are saved with the users ID.
I know how to select out the records and all that stuff, I just dont know how to get the user id and pass that on as a sql command.
If you are using ASP.NET authentication, the Profile
object should have all or most of the attributes associated with the logged-in user. Profile.UserName
will give you the username. You can also use User.Identity.Name
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.