public ActionResult login(log model) { bool Access; model = DFilter.Inspection(model); Access = model.accepted; if (!Access) { model._password = null; return(View(model)); } else { welcom Wmodel = new welcom(); FormsAuthentication.SetAuthCookie(model._UserName, false); HttpCookie cook = new HttpCookie("userName", model._UserName); Response.Cookies.Add(cook); //cook.Expires = DateTime.Now.AddHours(24); if (model.url != null) { return(Redirect(model.url)); } else { return(Redirect(Url.Action("Index", "Home", null))); } } }
public ActionResult welcom() { string user = Request.Cookies["userName"].Value.ToString(); mycontext data = new mycontext(); var _user = data.users.FirstOrDefault(m => m.UserName == user); welcom Wmodel = new welcom(); Wmodel.fullName = _user.ferstname + " " + _user.LastName; return(View(Wmodel)); }