当前位置: 首页>>代码示例>>C#>>正文


C# AuthenticateEventArgs类代码示例

本文整理汇总了C#中AuthenticateEventArgs的典型用法代码示例。如果您正苦于以下问题:C# AuthenticateEventArgs类的具体用法?C# AuthenticateEventArgs怎么用?C# AuthenticateEventArgs使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AuthenticateEventArgs类属于命名空间,在下文中一共展示了AuthenticateEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Login1_Authenticate

    protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
    {
        string strCon = ConfigurationManager.ConnectionStrings["LoginConnectionString"].ConnectionString;
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["LoginConnectionString"].ConnectionString);

        //using (SqlConnection con = new SqlConnection(strCon))
        {
            using (SqlCommand cmdStr = new SqlCommand("SELECT TOP(1) * FROM [Department] WHERE DepartmentID = '" + Login1.UserName +
                                                    "' AND DepartmentPassword = '" + Login1.Password + "'", con))
            {
                try
                {
                    con.Open();
                    if (cmdStr.ExecuteReader().HasRows)
                    {
                        e.Authenticated = true;
                        Session["login_name"] = Login1.UserName.ToString();
                        Session.Timeout = 40;

                        return;
                    }
                    else
                    {
                        Session.Abandon();
                    }
                }
                finally
                {
                    con.Close();

                }
            }

        }
    }
开发者ID:biigniick,项目名称:petegit,代码行数:35,代码来源:Login.aspx.cs

示例2: Login1_Authenticate

 protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
 {
     WorkerService ws = new WorkerService();
     Session["WorkerFirstName"] = ws.ValidateWorker(this.Login1.UserName, this.Login1.Password);
     if (Session["WorkerFirstName"] != null)
         e.Authenticated = true;
 }
开发者ID:N1vS,项目名称:School-Project,代码行数:7,代码来源:LoginWorker.aspx.cs

示例3: Login_Authenticate

 protected void Login_Authenticate(object sender, AuthenticateEventArgs e)
 {
     if (Membership.ValidateUser(Login.UserName, Login.Password))
     {
         FormsAuthentication.RedirectFromLoginPage(Login.UserName, false);
     }
 }
开发者ID:Bud0019,项目名称:Diplomka,代码行数:7,代码来源:Login_page.aspx.cs

示例4: loginWindow_Authenticate

 protected void loginWindow_Authenticate(object sender, AuthenticateEventArgs e)
 {
     if (PasswordHelper.authenticateUser(loginWindow.UserName.ToString(), loginWindow.Password.ToString()))
         e.Authenticated = true;
     else
         e.Authenticated = false;
 }
开发者ID:Raedot,项目名称:IIO13200-OHJELMOINTIKOE,代码行数:7,代码来源:f6694_T3.aspx.cs

示例5: LoginUser_Authenticate

    protected void LoginUser_Authenticate(object sender, AuthenticateEventArgs e)
    {
        SqlConnection con = new SqlConnection();
        //string hh = "select *from tbuser where uname='" + Login1.UserName + "' and upass='" + Encrypt(Login1.Password, true).ToString() + "'";
        con.ConnectionString = ConfigurationManager.ConnectionStrings["forest_depoConnectionString"].ConnectionString;
        con.Open();
        SqlCommand cmd = new SqlCommand();
        cmd.CommandText = "user_log";
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Connection = con;
        cmd.Parameters.Add("@un", SqlDbType.VarChar, 50).Value = LoginUser.UserName.ToString();
        cmd.Parameters.Add("@up", SqlDbType.VarChar, 50).Value = LoginUser.Password.ToString();
        SqlDataReader dr = cmd.ExecuteReader();
        dr.Read();
        if (dr.HasRows)
        {

            FormsAuthenticationTicket tkt = new FormsAuthenticationTicket(1, LoginUser.UserName, DateTime.Now, DateTime.Now.AddHours(2), false, dr[3].ToString(), FormsAuthentication.FormsCookiePath);
            string st1;
            st1 = FormsAuthentication.Encrypt(tkt);
            HttpCookie ck = new HttpCookie(FormsAuthentication.FormsCookieName, st1);
            Response.Cookies.Add(ck);
            string role = dr[3].ToString();

            //if (dr[3].ToString() == "admin".ToString())
            //{
            //    //Response.Redirect("focus1/admin/");
            Session["start_a"] = "start";
            if (dr["role"].ToString() == "admin")
            {
                Response.Redirect("../admin/speces_size_type.aspx");
            }
            if (dr["role"].ToString() == "admin2")
            {
                Response.Redirect("../admin2/auc_cal.aspx");
            }
            if (dr["role"].ToString() == "admin3")
            {
                Response.Redirect("../admin3/gate_pass.aspx");
            }
            if (dr["role"].ToString() == "admin4")
            {
                Response.Redirect("../admin4/");
            }

        }
        //    else
        //    {
        //        Session["start_u"] = "start";
        //        // Response.Redirect("focus1/user/");
        //        Response.Redirect("user/");
        //    }
        //}

        else
        {
            LoginUser.FailureText = "Wrong UserName or Password";
            //Response.Redirect("error.aspx");
        }
    }
开发者ID:hpie,项目名称:hpie,代码行数:60,代码来源:Login.aspx.cs

示例6: AuthenticateAsync

        public Task<bool> AuthenticateAsync()
        {
            if (this.AuthenticationRequested == null)
            {
                throw new NotSupportedException("Must provide a AuthenticationRequested event handler.");
            }

            var args = new AuthenticateEventArgs();
            this.AuthenticationRequested(this, args);

            if (!args.IsSuccessful.HasValue)
            {
                throw new NotSupportedException("Must specify Success/Failure in event handler");
            }

            this.IsAuthenticated = args.IsSuccessful.Value;
            this.CurrentUserId = args.Id;

            if (this.IsAuthenticatedChanged != null)
            {
                this.IsAuthenticatedChanged(this, EventArgs.Empty);
            }

            return Task.FromResult(this.IsAuthenticated);
        }
开发者ID:kieranlynam,项目名称:LondonCoffee,代码行数:25,代码来源:MockIdentityService.cs

示例7: Login1_Authenticate

    protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
    {
        String sqlCommand = "SELECT NIF FROM Clientes WHERE NIF=\"" + Login1.UserName + "\"";
        // como nao temos passwords na bd, apenas interessa o nif

        SqlCommand sql = new SqlCommand();
        sql.CommandType = CommandType.Text;
        sql.Connection = editoraConnection;
        sql.CommandText = sqlCommand;

        editoraConnection.Open();
        int val = sql.ExecuteNonQuery();
        editoraConnection.Close();

        if(val == 1)
        {
            // sucesso
        }
        else
        {
            // falha
            um.logInUser(Login1.UserName);
            Response.Redirect("Default.aspx");
        }
    }
开发者ID:pbucho,项目名称:Citeforma-ASP,代码行数:25,代码来源:login.aspx.cs

示例8: Login_Authenticate

    protected void Login_Authenticate(object sender, AuthenticateEventArgs e)
    {
        String loginUsername = aspLogin.UserName;
        String loginPassword = aspLogin.Password;

        if (Membership.ValidateUser(loginUsername, loginPassword))
        {
            e.Authenticated = true;
            Response.Redirect("splash.aspx", false);
        }
        else
        {
            bool successfulUnlock = AutoUnlockUser(loginUsername);
            if (successfulUnlock)
            {
                //re-attempt the login
                if (Membership.ValidateUser(loginUsername, loginPassword))
                {
                    e.Authenticated = true;
                    Response.Redirect("splash.aspx", true);
                }
                else
                {
                    e.Authenticated = false;
                    // Error message to display same message if user exsits and password incorrect for security reasons.
                    Info.Text = ErrorMessage + "Your username and/or password are invalid." + " <a href='forgottenpassword.aspx'>Click here</a> if you have forgotten your details.</div></div>";
                }
            }
            e.Authenticated = false;
            Info.Text = ErrorMessage + "Your username and/or password are invalid." + " <a href='forgottenpassword.aspx'>Click here</a> if you have forgotten your details.</div></div>";
            Info.Visible = true;
            // NovaLogin.FailureText = "Your username and/or password are invalid.";
        }
    }
开发者ID:nudtchengqing,项目名称:FootBallPredictor,代码行数:34,代码来源:Login.aspx.cs

示例9: Login1_Authenticate

    protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
    {
        try
        {

            if (BiFactory.CheckLogin(Login1.UserName, Login1.Password))
            {
                FormsAuthentication.SetAuthCookie(BiFactory.User.Nombre, true);
                Logger.Log(TipoEvento.Login,"Inició Session");
                //Response.Redirect("../default.aspx");
                Response.Redirect("~/solicitudes/Solicitudes.aspx");

            }
            else
            {
                Session["user"] = null;
              //  Logger.Log(TipoEvento.Login, Login1.UserName.ToString() + " Intento Conectarse al Sistema");
            }
        }
        catch (Exception ex)
        {
            lblMensaje.Text = ("Error" + ex.Message.ToString());
            Login1.InstructionText = "Usuario invalido";
        }
    }
开发者ID:alvaromejiaquiroz,项目名称:proyectomls,代码行数:25,代码来源:Login.aspx.cs

示例10: Login1_Authenticate

 protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
 {
     if (Login1.UserName == "ferroli" && Login1.Password == "901")
     {
         FormsAuthentication.RedirectFromLoginPage(Login1.UserName, Login1.RememberMeSet);
     }
 }
开发者ID:WouterBos,项目名称:graphite,代码行数:7,代码来源:Login.aspx.cs

示例11: Login1_Authenticate

    protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
    {
        DirectoryEntry entry = new DirectoryEntry("LDAP://NTNIGE", Login1.UserName, Login1.Password);
        try
        {
            object ent = entry.NativeObject;
            e.Authenticated = true;

           SqlConnection con = new SqlConnection();
           SqlCommand cmd = new SqlCommand();

           con.ConnectionString = ConfigurationManager.ConnectionStrings["nfte"].ConnectionString;
           cmd.Connection = con;
           cmd.CommandText = string.Format("select count(*) from nfte.users where userid = '{0}'", Login1.UserName.Trim());

           con.Open();
           object o =  cmd.ExecuteScalar();
           int usercount = Convert.ToInt32(o);

           if (usercount > 0)
           {
               FormsAuthentication.SetAuthCookie(Login1.UserName, false);
           }
           else
           {
               e.Authenticated = false;
               Login1.FailureText = "Your username or password is wrong,please check it and try again";
           }
        }
        catch
        {
            e.Authenticated = false;
            Login1.FailureText = "Internal error while trying to log in";
        }
    }
开发者ID:kanke,项目名称:Outsourced-Non-FTEs,代码行数:35,代码来源:Login.aspx.cs

示例12: Login1_Authenticate

    protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
    {
        string GetUserDetail = string.Format("select * from tb_user where username = '{0}' and [password] = '{1}' and status = '1'", Login1.UserName, Login1.Password );
        DataSet ds = dbTool.ExecuteDataSet(GetUserDetail);
        DataTable dt = ds.Tables[0];

        if (dt.Rows.Count != 1)
        {
            Login1.FailureAction = LoginFailureAction.RedirectToLoginPage;
        }
        else
        {
            string position = Convert.ToString(dt.Rows[0]["position"]);

            Session["userid"] = Convert.ToString(dt.Rows[0]["userid"]);
            Session["firstname"] = Convert.ToString(dt.Rows[0]["firstname"]);
            Session["lastname"] = Convert.ToString(dt.Rows[0]["lastname"]);

            if (position == "admin")
            {
                Response.Redirect("Admin/E-Library/addNewBook.aspx");
            }
            else if (position == "user")
            {
                //Response.Redirect("User/SearchByCategory.aspx");
                Response.Redirect("User/UserPanel.aspx");
            }
        }
    }
开发者ID:nutsukae,项目名称:E-library,代码行数:29,代码来源:login.aspx.cs

示例13: Login1_Authenticate

 protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
 {
     if ((((Login)sender).UserName == "Munuslito") && (((Login)sender).Password == "robinwalt98"))
     {
         e.Authenticated = true;
     }
 }
开发者ID:chevex-archived,项目名称:FordsCleaning,代码行数:7,代码来源:main.master.cs

示例14: LoginAuthenticate

    protected void LoginAuthenticate(object sender, AuthenticateEventArgs e)
    {
        TextBox uname = (TextBox)login.FindControl("UserName");
        TextBox pword = (TextBox)login.FindControl("Password");

        e.Authenticated = Membership.ValidateUser(uname.Text, pword.Text);
    }
开发者ID:huwred,项目名称:SnitzDotNet,代码行数:7,代码来源:login.ascx.cs

示例15: LoginUser_Authenticate

 protected void LoginUser_Authenticate(object sender, AuthenticateEventArgs e)
 {
     using (SqlConnection cn =
         new SqlConnection(ConfigurationManager.ConnectionStrings["WoWiConnectionString"].ConnectionString))
     {
         cn.Open();
         SqlCommand cmd =
             new SqlCommand("Select username from employee Where [email protected] and [email protected] and status='Active'", cn);
         cmd.Parameters.AddWithValue("@username", LoginUser.UserName);
         cmd.Parameters.AddWithValue("@password", LoginUser.Password);
         SqlDataReader dr = cmd.ExecuteReader();
         if (dr.HasRows)
         {
             while (dr.Read())
             {
                 string username = dr["username"].ToString();
                 using (WoWiModel.WoWiEntities wowidb = new WoWiModel.WoWiEntities())
                 {
                     int id = (from emp in wowidb.employees where emp.username == username select emp.id).First();
                     Session["Session_User_Id"] = id;
                 }
                 FormsAuthentication.RedirectFromLoginPage(username , LoginUser.RememberMeSet);
             }
         }
     }
 }
开发者ID:AdamsChao,项目名称:netdb-localdev-proj,代码行数:26,代码来源:Login.aspx.cs


注:本文中的AuthenticateEventArgs类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。