代码写一个Login控件:
//建立Login控件的实例
System.Web.UI.WebControls.Login userLogin = new System.Web.UI.WebControls.Login();
...
...
...
中间属性省略
...
...
//建立自定义的验证事件
userLogin.Authenticate += new AuthenticateEventHandler(userLogin_Authenticate);
//将Login控件加入Web Form
Page.FindControl("form1").Controls.Add(userLogin);现在我的userLogin_Authenticate如下:
void userLogin_Authenticate(object sender, AuthenticateEventArgs e)
{
Response.Write("<script>window.alert('提示语句');window.location='abc.aspx'</script>"); e.Authenticated = true; //验证通过
}
问题出现:
如果我把 e.Authenticated = true;删除 ,程序运行后,按登录按钮,则会弹出alert.如果把 e.Authenticated = true保留。则程序直接登录,不弹alert.为什么啊??哪位达人知道。。谢谢
//建立Login控件的实例
System.Web.UI.WebControls.Login userLogin = new System.Web.UI.WebControls.Login();
...
...
...
中间属性省略
...
...
//建立自定义的验证事件
userLogin.Authenticate += new AuthenticateEventHandler(userLogin_Authenticate);
//将Login控件加入Web Form
Page.FindControl("form1").Controls.Add(userLogin);现在我的userLogin_Authenticate如下:
void userLogin_Authenticate(object sender, AuthenticateEventArgs e)
{
Response.Write("<script>window.alert('提示语句');window.location='abc.aspx'</script>"); e.Authenticated = true; //验证通过
}
问题出现:
如果我把 e.Authenticated = true;删除 ,程序运行后,按登录按钮,则会弹出alert.如果把 e.Authenticated = true保留。则程序直接登录,不弹alert.为什么啊??哪位达人知道。。谢谢
猜猜的啊,应该是redirect的,没机会显示?