form验证

<authentication mode="Forms">
        <forms name="name" loginUrl="1.aspx" protection="All" timeout="60">
         <!--非数据库比较
         <credentials passwordFormat="Clear | md5 | SHA1">
         <user name="a" password="123">
         <user name="b" password="123">
         -->
        </forms>
</authentication>
<authorization>
<allow user=""/>
        <deny users="?, User1"/> //*号所有  ?匿名
/authorization>


if (验证合法)
System.Web.Security.FormsAuthentication.redirectFromLoginPage(this.TextBox1.Text, this.CheckBox.Checked)
or
System.Web.Security.FormsAuthentication.setAuthCookies(this.TextBox1.Text, this.CheckBox.Checked)
Response.redirect("1.aspx")

登出
System.Web.Security.FormsAuthentication.SignOut()


配合非数据库
System.Web.Security.FormsAuthentication.Authenticate(用户名, 密码)

产生hash数据
System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(password, format);
posted @ 2008-11-01 22:18  Edward Xie  阅读(219)  评论(0编辑  收藏  举报