コード例 #1
0
        /// <summary>
        /// The login action.
        /// </summary>
        /// <param name="username">The username.</param>
        /// <param name="password">The password.</param>
        /// <returns>Redirect to index view result.</returns>
        public ActionResult Login(string username, string password)
        {
            // Build the request
            var request = new AuthenticateRequest
            {
                Username = username,
                Password = password
            };

            // Call the service and get a response
            AuthenticateResponse response;

            using (var client = new AuthenticationServiceClient())
            {
                response = client.AuthenticateUser(request);
            }

            // If not authenticated, make a note for model state
            if (!response.IsAuthenticated)
            {
                TempData.Add("Authentication", "The username/password did not match any user.");
            }

            // Redirect to the index view
            return RedirectToAction("Index");
        }
コード例 #2
0
 public static ValidationResult AuthenticateUser(string userName, string password)
 {
     var client = new AuthenticationServiceClient("WSHttpBinding_IAuthenticationService");
     var userDetails = new UserDetails() { UserName = userName, Password = password };
     var authenticationResult = client.AuthenticateUser(userDetails);
     return authenticationResult;
 }
コード例 #3
0
        protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
        {
            logIn = LoginForm.UserName;
            pass  = LoginForm.Password;

            value = proxy.AuthenticateUser(logIn, pass);

            if (value != 0)
            {
                Session["Cuenta"]     = logIn;
                Session["Contraseña"] = pass;
                Session["rol"]        = value.ToString();


                switch (value)
                {
                case 1:
                    Response.Redirect("MenuAdministrador.aspx");
                    break;

                case 2:
                    //lblAdvertencia.Text = "Jefe de la DIPP";
                    break;

                case 3:
                    Response.Redirect("MenuDocente.aspx");
                    break;

                case 4:
                    Response.Redirect("CalificacionesEstudiante.aspx");
                    break;
                }
            }
        }