In my project I have an authentication module and logout . But I wanted it when the user logged in I would take the id from it so that I would display information about the login of it. Type a view of same details. But that the user who logged in had a link and that link already had his id so that when he clicked on the details page he would show the information and if you want to edit you can also get this id .
Namely, I'm using custom authentication. So how can I do this?
I'll put my actions and logout :
public ActionResult Index()
{
return View();
}
[HttpPost]
public ActionResult Index(String Login, String Senha)
{
//verificando login pelo usuario do banco de dados ...
Usuario login = db.Usuarios.Where(x => x.Login == Login && x.Senha == Senha).FirstOrDefault();
if (login != null)
{
FormsAuthentication.SetAuthCookie(Login, false);
Session.Add(".PermissionCookie", login.Perfil);
return RedirectToAction("Index", "Home"); //pagina padrao para todos os usuarios...
}
return RedirectToAction("Index");
}
public ActionResult Sair()
{
FormsAuthentication.SignOut();
Session.Remove(".PermissionCookie");
return RedirectToAction("Index");
}