Search code examples
c#asp.netwebformslogin-control

How to get User id after leave login page?


I develop asp.net Web Form application use VS2015. I used asp.net login control to identify user. How can I get the userID after the user have loged in and leave the login page?


Solution

  • Assuming that you are using ASP.NET Identity. You should be able to access the UserID of your authenticated in user by using this.Page.User.Identity.GetUserId(). Be sure to include using Microsoft.AspNet.Identity;.