Last post Nov 15, 2018 05:54 PM by mgebhard
Nov 15, 2018 05:05 PM|200382578|LINK
Hi, I am making an app where I have a table called users and rentals. Rentals have userId as a foreign key. Now I want not to let users fill in, but it should automatically take current logged in user. How do I do that?
Can anyone help?
Nov 15, 2018 05:54 PM|mgebhard|LINK
If you are using Identity, the user Id (and username) are available within every request after a successful login. Use this line to get the user's Id.
var userId = User.Identity.GetUserId()
Security basics are covered in the ASP.NET tutorials found by clicking the "Learn" link above.