• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# AuthenticateEventArgs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: myLogin_Authenticate

    protected void myLogin_Authenticate(object sender, AuthenticateEventArgs e)
    {
        // Get the email address entered
        TextBox EmailTextBox = myLogin.FindControl("Email") as TextBox;
        string email = EmailTextBox.Text.Trim();

        // Verify that the username/password pair is valid
        if (Membership.ValidateUser(myLogin.UserName, myLogin.Password))
        {
            // Username/password are valid, check email
            MembershipUser usrInfo = Membership.GetUser(myLogin.UserName);
            if (usrInfo != null && string.Compare(usrInfo.Email, email, true) == 0)
            {
                // Email matches, the credentials are valid
                e.Authenticated = true;
            }
            else
            {
                // Email address is invalid...
                e.Authenticated = false;
            }
        }
        else
        {
            // Username/password are not valid...
            e.Authenticated = false;
        }
    }
开发者ID:cweber-wou,项目名称:capstone,代码行数:28,代码来源:Login.aspx.cs


示例17: Login1_Authenticate

 protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
 {
     string conString = "Data Source=(LocalDB)\\v11.0;AttachDbFilename=|DataDirectory|\\Yummy.mdf;Integrated Security=True";
     string selectString = "SELECT * FROM tb_Userinfo WHERE Username='" + Login1.UserName + "'";//select string for search currency name correspond with the input
     SqlDataSource dsrc = new SqlDataSource(conString, selectString);
     DataView DV = (DataView)dsrc.Select(DataSourceSelectArguments.Empty);
     if (DV.Table.Rows.Count > 0)
     {
         string password = (string)DV.Table.Rows[0][7];
         if (password.Equals(Login1.Password))
         {
             //Label1.Text = "Congratulations! Login succeed! Please wait for redirect to Homepage!";
             Session["Username"] = Login1.UserName;
             Session["Call"] = DV.Table.Rows[0][1].ToString();
             Server.Transfer("~/WebSite2/Default.aspx");
             //Response.Write("<script language=javascript>alert('Congratulations! Login succeed!')</script>");
             //System.Threading.Thread.Sleep(5000);
             //Response.Redirect("~/WebSite2/Default.aspx");
         }
         else
             e.Authenticated = false;
     }
     else
         e.Authenticated = false;
 }
开发者ID:Tommyhank,项目名称:UIinterface,代码行数:25,代码来源:Login.aspx.cs


示例18: Login1_Authenticate

 protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
 {
     try
     {
         cargarWCF();
         //Usuarios unUsu = FabricaLogica.GetLogicaUsuarios().Logueo(Login1.UserName,Login1.Password);
         Usuarios unUsu = trivias.Logueo(Login1.UserName, Login1.Password);
         trivias.Close();
         if (unUsu != null)
         {
             Session["Usuario"] = unUsu;
             if (unUsu is Jugador)
             {
                 Response.Redirect("descargar.aspx");
             }
             else if (unUsu is Admin)
             {
                 Response.Redirect("abmPreguntas.aspx");
             }
         }
         else
         {
             Response.Write("<div id=\"error\" class=\"alert alert-warning\">Error en el Logueo</div>"
             + "<script type=\"text/javascript\">window.onload=function(){alertBootstrap();};</script>");
             Login1.UserName = "";
         }
     }
     catch (Exception ex)
     {
         trivias.Abort();
         Response.Write("<div id=\"error\" class=\"alert alert-danger\">"+ex.Message+"</div>"
             + "<script type=\"text/javascript\">window.onload=function(){alertBootstrap();};</script>");
         Login1.UserName = "";
     }
 }
开发者ID:maxijoga10,项目名称:Trivias,代码行数:35,代码来源:Default.aspx.cs


示例19: LoginButton_Click1

    protected void LoginButton_Click1(object sender, AuthenticateEventArgs e)
    {
        string password = this.Password.Text;
        string usuario = this.UserName.Text;

        GestionUsuario gestor = new GestionUsuario();

        if (gestor.ValidateUser(usuario, password))
        {

            MembershipUser usrInfo = Membership.GetUser(usuario);
            if (usrInfo != null)
            {
                // Email matches, the credentials are valid
                e.Authenticated = true;
            }
            else
            {
                // Email address is invalid...
                e.Authenticated = false;
            }
        }
        else
        {
            // Username/password are not valid...
            e.Authenticated = false;
        }
    }
开发者ID:di3goandres,项目名称:Proyecto3,代码行数:28,代码来源:Login.aspx.cs


示例20: Login1_Authenticate

 protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
 {
     String username = Login1.UserName;
     String pwd = DataHelper.PasswordEncrypt(Login1.Password);
     string t = DataHelper.PasswordEncrypt("admin");
     string sql="SELECT *  FROM [Seminar].[dbo].[User] where [UserName]='"+username+"' and [PassWord]='"+pwd+"'";
     object user = SqlHelper.ExecuteScalar(sql);
     if (user != null)
     {
         e.Authenticated = true;
         Session["admin_id"] = user;
     }
     else
     {
         e.Authenticated = false;
     }
        /* SqlConnection connection = new SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings["Seminar"].ConnectionString.ToString());
     connection.Open();
     SqlCommand mycommand = new SqlCommand();
     mycommand.Connection = connection;
     mycommand.CommandText = "SELECT *  FROM [Seminar].[dbo].[User] where [UserName]='"+username+"' and [PassWord]='"+pwd+"'";
     object t= mycommand.ExecuteScalar();
     if (t != null)
     {
         e.Authenticated = true;
         Session["Admin_ID"] = username;
     }
     else
     {
         e.Authenticated = false;
     }
     conn.close();*/
 }
开发者ID:caogang,项目名称:Seminar,代码行数:33,代码来源:Login.aspx.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Authentication类代码示例发布时间:2022-05-24
下一篇:
C# Authenticate类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap