功能检查密码 [英] function check password
问题描述
大家好,
在下面的代码中遇到一个问题,
我用c#
由ASP.NET 4.0开发的代码
我想做的那一刻是,
检查密码.
我已经检查了两个条件
1.如果我输入了错误的密码,我需要显示无效密码"
2.否则为有效密码.
但是我的代码甚至总是返回无效的密码
如果我也输入有效密码.
请在下面查看我的代码.
代码:
Hi all,
am facing one problem on my code below,
the code which i was developed by ASP.NET 4.0 with c#
the moment i wanted to do is,
to check the password.
i have check the two condition
1. if i enter wrong password,i need to display "invalid password"
2. or else valid password.
but my code always return invalid password even
if i enter valid password also.
so kindly look at my code below.
code:
protected void btnpwd_Click(object sender, EventArgs e)
{
clsCommon clsobj = new clsCommon();
string[] result = new string[2];
result = clsobj.FnCheckPassword(Session["talkuser_id"].ToString(), pwd1.Text.Trim());
if (result[0] == "0")
{
lblStatus.Text = "Invalid Password";
return;
}
else
{
lblStatus.Text = "valid";
}
}
感谢所有
thanks to all
推荐答案
下面的文章很好地解释了如何调试ASP.Net Web应用程序
ASP.NET调试概述 [ ASP.NET调试 [
Below articles are good in explaining how to debug ASP.Net Web application
ASP.NET Debugging Overview[^]
ASP.NET Debugging[^]
应该很简单.您可以将密码存储在变量中,然后检查输入的密码是否相同.例如:
It should be very simple. You can store the password in a variable and then check if the entered password is the same or not. For example:
string pwd = kilo;
if (txtPass.Text == pwd)
{
lblStatus.Text = "valid";
}
else
{
lblStatus.Text = "Invalid Password";
return;
}
我在这里使用了文本框,因为我不知道clsobj是什么,所以如果您告诉我它是什么类型的组件,我也许可以为您提供更好的帮助.另外,您可以参考我的代码自己弄清楚,或者给我有关您提供的代码的其他信息.
I used textbox over here as I don''t know what clsobj is, so if you tell me what type of component it is, I may be able to help you better. Alternatively, you could figure it out yourself by referring to my code or give me additional information on the code you provided.
这篇关于功能检查密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!