예제 #1
0
        public void Application_PostAuthenticateRequest()
        {
            HttpCookie cookie = Request.Cookies["TicketEmpleado"];

            if (cookie != null)
            {
                FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(cookie.Value);

                String username = ticket.Name;
                int    emp_no   = int.Parse(ticket.UserData);

                GenericIdentity     identidad = new GenericIdentity(username);
                RepositoryEmpleados repo      = new RepositoryEmpleados();
                Empleado            empleado  = repo.BuscarEmpleado(emp_no);
                HttpContext.Current.User = empleado;
            }
        }
예제 #2
0
        //SI NO ESCRIBIMOS BIEN EL METODO, NOS QUEDAMOS EN LOGIN
        public void Application_PostAuthenticateRequest()
        {
            HttpCookie cookie = Request.Cookies["TICKETEMPLEADO"];

            if (cookie != null)
            {
                String datos = cookie.Value;
                FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(datos);
                int             empno            = int.Parse(ticket.UserData);
                String          username         = ticket.Name;
                GenericIdentity identity         = new GenericIdentity(username);
                //GenericPrincipal usuario = new GenericPrincipal(identity, roles);

                //DE DONDE SACO ESTE EMPLEADO?
                RepositoryEmpleados repo     = new RepositoryEmpleados();
                Empleados           empleado = repo.BuscarEmpleado(empno);
                empleado.Identity        = identity;
                HttpContext.Current.User = empleado;
            }
        }
예제 #3
0
 public Empleado Get(int id)
 {
     return(repo.BuscarEmpleado(id));
 }