aspx登陆不了(使用asp ajax1.0)
高手帮忙:
我的配置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里调试的.