为了忘记密码,我们使用电子邮件,并且该密码希望显示在标签下方. [英] for forget password we use email and that password want to display in below label ..

查看:60
本文介绍了为了忘记密码,我们使用电子邮件,并且该密码希望显示在标签下方.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尊敬的专家,
谁能帮帮我..
我想通过数据库在标签中显示密码..plzzz帮我...

Dis是我的源代码..


Dear Experts,
Can any one help to me..
i want to display the password in label through database..plzzz help me...

Dis is my source code..


<form id="form1" runat="server">
    <div>
    <fieldset>
   <legend>Forgot Password</legend>
   <div>
        <asp:Label ID="lblEmail" runat="server" Text="Email Address"></asp:Label>
    <asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>
        <asp:RequiredFieldValidator ID="RV1" runat="server" ControlToValidate="txtEmail" ErrorMessage="Please Enter Emailid"> *</asp:RequiredFieldValidator>

    <asp:Button ID="btnsubmit" runat="server" Text="Submit" onclick="btnsubmit_Click" />
  </div>
    <div>
        <asp:Label ID="Label1" runat="server" Text="Password"></asp:Label>

    </div>
    </fieldset>
    </div>
    </form>




我的aspx.cs代码:




my aspx.cs code:

protected void btnsubmit_Click(object sender, EventArgs e)
    {


        SqlCommand cmd = new SqlCommand("Ldetails", con);
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.AddWithValue("@EmailID", txtEmail.Text);

        con.Open();
        cmd.ExecuteNonQuery();
        con.Close();


    }

推荐答案

我强烈建议不要实施此类逻辑来找回丢失的密码.

您绝不应该以明文形式显示密码(避免也将明文密码存储在DB中!)
对于密码丢失的情况,您可以发送带有为该帐户生成的新随机密码的电子邮件,也可以将旧密码发送到已注册的电子邮件.

在屏幕上显示密码是一个很大的安全漏洞.


但是,如果您愿意,则基于共享的内容,您似乎会尝试获取给定电子邮件地址的密码.
步骤:
1.从用户那里获取电子邮件地址
2.从数据库中获取电子邮件的密码
3.显示步骤2中返回的数据.

对于2& 3,使用ADO.NET,以下文章会有所帮助:
通过C#访问SQL Server的入门指南 [ ^ ]
使用ADO.NET访问数据 [
I would strongly suggest not to implement such logic for retrieving lost password.

You should at no point display password in clear text (avoid storing clear passwords in DB too!)
For lost password case, either you send an email with new random password generated for the account or send old password to registered email.

Displaying password on screen is a big security loop hole.


Yet, if you want to, based on what you have shared, it looks like you try to get a password for given email address.
Steps:
1. Get email address from user
2. Get password for the email from database
3. Show the data returned in step 2.

For 2 & 3, use ADO.NET, following article will help:
Beginners guide to accessing SQL Server through C#[^]
Accessing data with ADO.NET[^]


按钮获取数据的功能是什么,为什么要使用ExecuteNonQuery(),
使用ExecuteReader()获取密码,然后将其显示在标签上
What is the function of your button to get data why are you using ExecuteNonQuery(),
use ExecuteReader() to get the password then display it to label


这篇关于为了忘记密码,我们使用电子邮件,并且该密码希望显示在标签下方.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆