注册 登录
编程论坛 ASP.NET技术论坛

login控件中如何进行身份验证

小笨笨 发布于 2007-11-06 14:18, 849 次点击
login控件验证身份时,是否需要在cs文件中写其他代码?为什么我看很多教材上都不要求写代码了?

以下是我在cs文件中写的代码,这样写是否正确?
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
if (Login1.UserName == "1 " && Login1.Password == "1 ")
{
//System.Web.Security.FormsAuthentication.SetAuthCookie(Login1.UserName , .Login1.RememberMeSet);
e.Authenticated = true;
}
}

是应该使用
System.Web.Security.FormsAuthentication.SetAuthCookie(Login1.UserName , .Login1.RememberMeSet);
还是应该使用
e.Authenticated = true
源代码下载
0 回复
1