标题:登陆页面问题
只看楼主
wuda8
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2006-8-3
 问题点数:0 回复次数:1 
登陆页面问题
我想用 2.0实现 用textbox控件和button来设置一个登陆页面,可是不知道该怎样用textbox和数据库中的用户名与密码比较;
搜索更多相关主题的帖子: 页面 登陆 
2006-08-03 17:33
飞鱼
Rank: 1
等 级:新手上路
帖 子:38
专家分:0
注 册:2006-2-27
得分:0 
private void btnlogin_click(object sender,system.eventargs e)
{
string sql="select userid from users where username='"+txtusername.text.replace("'","_")+"'and userpassword='"+system.web.security.formsauthentication.hashpasswordforstoringinconfigfile(txtpassword.text,"md5")+"'";
if()
{
system.web.security.formsauthentication.setauthcookie(userid,false)
response.redirect("afterlogin.aspx");
}
else
{
//用户不合法,提示错误信息!
}
}
2006-08-05 09:02



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-81931-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.651340 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved