ASP.NET登录身份验证 一
2007-11-13 22:09
357 查看
reference:
http://blog.csdn.net/haojialin/archive/2006/01/13/578869.aspx
新建一个vs2005 web项目,修改web.config下面的authentication / authorization 节点
<authentication mode="Forms">
<forms loginUrl="Login.aspx" name=".ASPXAUTH"></forms>
</authentication>
<authorization>
<deny users="?"></deny>
</authorization>
新建2个页面:
Login.aspx
页面添加2个textbox,1个button,后台添加buttonclick事件:
protected void Button1_Click(object sender, EventArgs e)
{
if (this.Txt_UserName.Text == "Admin" && this.Txt_Password.Text == "123456")
{
System.Web.Security.FormsAuthentication.RedirectFromLoginPage(this.Txt_UserName.Text, false);
}
}
Default.aspx
在页面添加一个button,后台添加一个事件:
protected void Button1_Click(object sender, EventArgs e)
{
System.Web.Security.FormsAuthentication.SignOut();
Server.Transfer("Login.aspx");
}
http://blog.csdn.net/haojialin/archive/2006/01/13/578869.aspx
新建一个vs2005 web项目,修改web.config下面的authentication / authorization 节点
<authentication mode="Forms">
<forms loginUrl="Login.aspx" name=".ASPXAUTH"></forms>
</authentication>
<authorization>
<deny users="?"></deny>
</authorization>
新建2个页面:
Login.aspx
页面添加2个textbox,1个button,后台添加buttonclick事件:
protected void Button1_Click(object sender, EventArgs e)
{
if (this.Txt_UserName.Text == "Admin" && this.Txt_Password.Text == "123456")
{
System.Web.Security.FormsAuthentication.RedirectFromLoginPage(this.Txt_UserName.Text, false);
}
}
Default.aspx
在页面添加一个button,后台添加一个事件:
protected void Button1_Click(object sender, EventArgs e)
{
System.Web.Security.FormsAuthentication.SignOut();
Server.Transfer("Login.aspx");
}
相关文章推荐
- asp.net用户身份验证时读不到用户信息的问题 您的登录尝试不成功。请重试。 Login控件
- 如何设置混合身份验证?— —或 'IIS APPPOOL\ASP.NET v4.0' 登录失败
- asp.net中的窗体身份验证(完整篇之三:用户登录页面)
- asp.net登录 用Forms身份验证和基于角色的分目录访问
- 两系统用asp.net forms 身份验证方式实现跨域登录信息共享
- 实现基于 ASP.NET Forms 身份验证的跨子域单点登录
- ASP.NET Forms身份验证登录
- asp.net forms 身份验证方式下跨域登录信息共享的实现方法
- asp.net身份验证(登录控件),基于标准的sqlserver.(vs2005+sqlserver2005)
- ASP.NET 登录身份验证 二 自定义模式(framework)
- ASP.NET中获取登录用户ID 用户身份验证
- ASP.NET 实现简单的 Forms 身份验证登录
- asp.net用户身份验证时读不到用户信息的问题 您的登录尝试不成功。请重试。 Login控件
- asp.net中的窗体身份验证(完整篇之三:用户登录页面)
- asp.net中的窗体身份验证(完整篇之五:退出登录)
- asp.net身份验证(登录控件),基于标准的sqlserver.(vs2005sqlserver2005)
- asp.net中的窗体身份验证(完整篇之五:退出登录)
- asp.net forms 身份验证方式下跨域登录信息共享的实现方法
- 总结asp.net的身份验证方式
- ASP .NET 中的身份验证:.NET 安全性指导