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


C# MD5.Encrypt方法代码示例

本文整理汇总了C#中MD5.Encrypt方法的典型用法代码示例。如果您正苦于以下问题:C# MD5.Encrypt方法的具体用法?C# MD5.Encrypt怎么用?C# MD5.Encrypt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MD5的用法示例。


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

示例1: btsubmit_Click

 protected void btsubmit_Click(object sender, EventArgs e)
 {
     try
     {
         if (email.Length == 0)
         {
             divshow.Visible = false;
             return;
         }
         string pass1 = txtpass.Value.Trim();
         string pass2 = txtpass1.Value.Trim();
         if (pass1.Length == 0)
         {
             divErrors.Visible = true;
             divErrors.InnerHtml = "<div class='diverror'>" + terrpass + "</div>";
             return;
         }
         else if (pass1.Length < 4)
         {
             divErrors.Visible = true;
             divErrors.InnerHtml = "<div class='diverror'>" + tpassleng + "</div>";
             return;
         }
         else if (!pass1.Equals(pass2))
         {
             divErrors.Visible = true;
             divErrors.InnerHtml = "<div class='diverror'>" + tincorrect + "</div>";
             return;
         }
         //Insertpass:
         MD5 md5=new MD5();
         string encodepass = md5.Encrypt(pass1);
         if (UserManager.UserUpdateNewPass(email, encodepass))
         {
             tmessage = tyestochange;
             divshow.Visible = false;
             return;
         }
         else
         {
             divErrors.Visible = true;
             divErrors.InnerHtml = "<div class='diverror'>" + terrUpdate + "</div>";
             return;
         }
     }
     catch
     { }
 }
开发者ID:BGCX261,项目名称:zlap-svn-to-git,代码行数:48,代码来源:UserGetNewPassword.ascx.cs

示例2: register_Click

    protected void register_Click(object sender, EventArgs e)
    {
        string username = txtusername.Value.Trim();
        string pass1 = txtpass.Value.Trim();
        string pass2 = txtpass1.Value.Trim();
        string fullname = txtname.Value.Trim();
        string jobtitle = txtjobtitle.Value.Trim();
        string email = txtemail.Value.Trim();
        string mobile = txtmobile.Value.Trim();
        string homephone = txthomephone.Value.Trim();
        string address = txtaddress.Value.Trim();
        string code = txtcoderegister.Value.Trim();
        CManageError errors = ValidateForm(username, pass1, pass2, fullname, jobtitle, address, email, mobile, homephone, code);
        if (errors.GetNumberErr() > 0)
        {
            divErrors.Disabled = false;
            divErrors.InnerHtml = "<div class='diverror'>" + errors.GetAllError() + "</div>";
        }
        else
        {
            MD5 md5 = new MD5();
            pass1 = md5.Encrypt(pass1);
            UserManagerSystem managerUser = new UserManagerSystem();
            Boolean test = managerUser.UserInsert(username, pass1, fullname, "", jobtitle, address, "", "", "", address, "", "", "", mobile, "", homephone, "", "", email, "", "");
            if (test)
            {
                DataSet dsUser = managerUser.GetUserAccount(username);
                if (dsUser.Tables.Count > 0)
                {
                    if (dsUser.Tables[0].Rows.Count > 0)
                    {
                        string[] userAcount = new string[3];
                        userAcount[0] = dsUser.Tables[0].Rows[0]["id"].ToString();
                        userAcount[1] = dsUser.Tables[0].Rows[0]["UserName"].ToString();
                        userAcount[2] = dsUser.Tables[0].Rows[0]["ContactName"].ToString();
                        Session["infoUser"] = userAcount;
                        //Send email:

                        Response.Redirect("Default.aspx");
                    }
                }
            }
            else
            {
                divErrors.Disabled = false;
                divErrors.InnerHtml = "<div class='diverror'>" + terrConnect + "</div>";
            }
        }
    }
开发者ID:BGCX261,项目名称:zlap-svn-to-git,代码行数:49,代码来源:RegistUser.ascx.cs

示例3: changepass_Click

 protected void changepass_Click(object sender, EventArgs e)
 {
     try
     {
         string pass1 = txtpass1.Value.Trim();
         string pass2 = txtpass2.Value.Trim();
         if ((pass1.Length == 0) || (pass2.Length == 0))
         {
             diverror1.Visible = true;
             diverror1.InnerHtml = "<div class='diverror'>" + terrcommon + "</div>";
             return;
         }
         else if (pass1.Length < 4)
         {
             diverror1.Visible = true;
             diverror1.InnerHtml = "<div class='diverror'>" + terrlengpass + "</div>";
             return;
         }
         else if (!pass1.Equals(pass2))
         {
             diverror1.Visible = true;
             diverror1.InnerHtml = "<div class='diverror'>" + terrpass + "</div>";
             return;
         }
         MD5 md5 = new MD5();
         pass1 = md5.Encrypt(pass1);
         string[] arrstr = (string[])Session["infoUser"];
         Users.UserUpdateNewPassId(int.Parse(arrstr[0]), pass1);
         diverror1.Visible = true;
         diverror1.InnerHtml = "<div class='diverror'>" + tyestochange + "</div>";
         return;
     }
     catch
     {
         diverror1.Visible = true;
         diverror1.InnerHtml = "<div class='diverror'>" + terrUpdate + "</div>";
         return;
     }
 }
开发者ID:BGCX261,项目名称:zlap-svn-to-git,代码行数:39,代码来源:ChangeAccount.ascx.cs


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