aspx登陆不了(使用asp ajax1.0)

jkluooop 2008-12-10 10:47:40
高手帮忙:
我的配置web.config如下:
<connectionStrings>
<add name="dbconn" connectionString="data source=10.1.1.13\db;uid=sa;pwd=123456;initial catalog=hr" providerName="System.Data.SqlClient"/>
<add name="MembershipConn" connectionString="data source=10.1.1.13\db;uid=sa;pwd=123456;initial catalog=aspnetdb" providerName="System.Data.SqlClient"/>
</connectionStrings>
我的代码如下:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using OA.Model;
using OA;
public partial class _Login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void btnlogin_Click(object sender, EventArgs e)
{
if(string.IsNullOrEmpty(this.username.Text))
{
MessageBox.Show(this, "Please input the user name.");
this.username.Focus();
return;
}
if (string.IsNullOrEmpty(this.password.Text))
{
MessageBox.Show(this,"Please input the password.");
this.password.Focus();
return;
}
if (Membership.ValidateUser(this.username.Text, this.password.Text))
{
if (Roles.IsUserInRole(this.username.Text, "MaterialUsers"))
{
System.Web.Security.FormsAuthentication.SetAuthCookie(this.username.Text, true);
Response.Redirect(System.Web.Security.FormsAuthentication.GetRedirectUrl(this.username.Text, true));
}
else
MessageBox.Show(this, "Access deny!");
}
else
{
MessageBox.Show(this, "User name or Password wrong, please try again."); }
}
}
结果出现红色提示?这是怎么回事呀,登陆不了,用户名跟密码肯定没错的,我在vs2008里调试的.
...全文
45 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
quincystar 2008-12-10
  • 打赏
  • 举报
回复
建议你单步跟踪,查看一下到底是哪里出错了.
jkluooop 2008-12-10
  • 打赏
  • 举报
回复
不管了,干脆把登陆,用户验证的密码全从cs里删去了....

17,740

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 .NET Framework
社区管理员
  • .NET Framework社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧