I have code for successful Login,Here is my code
Note: I am using my own membership Provider,I am not using its own membership class
if (ModelState.IsValid) { if (user.IsValid(user.Email, user.Password)) { FormsAuthentication.SetAuthCookie(user.Email, true); return RedirectToAction("Index", "TestValidUser"); } else { ModelState.AddModelError("", "Login data is incorrect!"); } }
I have this simple class/Model
[Key] public int Id { get; set; } public string Email { get; set; } public string Password { get; set; } public string RoleName { get; set; }
Now i have two questions
- I want to get UserId of Currently Login user
- I want to check RoleName of logedin user