I am doing a group project with 4 other people. We are designing a job kiosk in ASP.NET in MVC4 with embedded c#.
I am working on having the system log the user out
Here is how I do it if you are using FormsAuthentication:
Controller Action:
public ActionResult CheckLogin()
{
if (Request.Cookies["CookieName"] == null) return Json(0, JsonRequestBehavior.AllowGet);
var cookie = Request.Cookies["CookieName"].Value;
var ticket = FormsAuthentication.Decrypt(cookie);
var secondsRemaining = Math.Round((ticket.Expiration - DateTime.Now).TotalSeconds, 0);
return Json(secondsRemaining, JsonRequestBehavior.AllowGet);
}
Jquery on each page or on layout page: