public ActionResult Default(UserProfile profile, string returnUrl) { //check Cookie if (UserProfile.CheckUserCookie(profile)) { return(returnUrl != null ? (ActionResult)Redirect(returnUrl) : RedirectToAction("Default", "Dashboard", new { area = "ControlPanel" })); } if (Identity.UserID != null) // login from cu { profile.Id = Identity.UserID; profile.LoginName = Identity.UserFullName; profile.Name = Identity.UserFullName; profile.LastVisitTime = Identity.LastVisit; HttpContext.Session["_Profile"] = profile; } //Check Seesion if (profile != null && profile.Id != null) { return(returnUrl != null ? (ActionResult)Redirect(returnUrl) : RedirectToAction("Default", "Dashboard", new { area = "ControlPanel" })); } //Login page return(View()); }