C语言编程忘记密码功能实现方法.pdf

  1. 1、本文档共7页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
上学吧( ) C 语言编程忘记密码功能的实现方法 本文将给出通过C#编程来实现 忘记密码功能的方法和代码,大家可 以参照本文的思路自己写出这个功能代码…… 以下是引用片段: int result = user.GetBackPassword(LoginName.Text.Trim(), Question.Tex t.Trim(), Answer.Text.Trim(), Email.Text); if (result == 1) { Message.Text = 您的密码已发送,请到邮箱查收; //user.ChangePassword( } else { Message.Text = 您的输入信息有误!; } public int GetBackPassword(string userName, string question, string ans 第 1 页,共 7 页 上学吧为您提供“安全工程师”考试复习资料下载(/share/s23.htmll ) 上学吧( ) wer, string email) { object m_DBNull = Convert.DBNull; //获得新的随机密码 string newPassword = MakePassword(6); //定义存储过程参数 SqlParameter[] para = { new SqlParameter(@userName, userName), new SqlParameter(@question, question), new SqlParameter(@answer, answer), new SqlParameter(@newPassword, newPassword), new SqlParameter(@result, SqlDbType.Int, 8, ParameterDirectio n.Output, true, 0, 0, , DataRowVersion.Default, m_DBNull) }; //执行存储过程 try { DAL.SQLHelper.ExecuteNonQuery(DAL.SQLHelper.CONN_STRING, Co mmandType.StoredProcedure, 第 2 页,共 7 页 上学吧为您提供“安全工程师”考试复习资料下载(/share/s23.htmll ) 上学吧( ) GetBackPwd, para); } catch { throw new Exception(邮件无法发送!); } //获得输出参数的值 int result = Convert.ToInt32(para[4].Value); //如果密码保护资料填写正确 if (result == 1) { //从Web.config 获取发信人地址、邮件标题、邮件用户名和密码以 及SmtpServer string sender = System.Configuration.ConfigurationSettings.AppSettin gs[mainSender]; string title = System.Configuration.ConfigurationSettings.AppSettings[ mailTitle]; string mailUser = System.Configuration.ConfigurationSettings.AppSett ings[mailUser]; string mailPwd = System.Configuration.ConfigurationSettings.AppSetti ng

文档评论(0)

xuefei111 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档