Beispiel #1
0
        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)));
                }
            }
        }
Beispiel #2
0
        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));
        }