Ejemplo n.º 1
0
 public ActionResult Index(UserModel User)
 {
     AutoMapper.Mapper.CreateMap<UserModel, tb_Users>();
     tb_Users newUser = new tb_Users();
     newUser = AutoMapper.Mapper.Map(User, newUser);
     if (_userClass.usp_CheckLogin(newUser) == 1)
     {
         FormAuthentication(User);
         return RedirectToAction("News", "Admin");
     }
     ViewBag.Message = "Please enter valid Username & Password";
     return View(); ;
 }
Ejemplo n.º 2
0
        public void FormAuthentication(UserModel User)
        {
            //string userData = JsonConvert.SerializeObject(User);
            //FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(
            //1,
            //User.First_Name,
            //DateTime.Now,
            //DateTime.Now.AddMinutes(15),
            //false, //pass here true, if you want to implement remember me functionality
            //userData);

            //string encTicket = FormsAuthentication.Encrypt(authTicket);
            Session["User"] = User;
            FormsAuthentication.SetAuthCookie(User.User_Name, false);
            //HttpCookie faCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket);
            //Response.Cookies.Add(faCookie);
        }