我已经设置了验证基于我从MCTS自控进度培训工具包MCTS考试70-562理解下面的表格,但它不验证...窗体身份验证不验证
<authentication mode="Forms">
<forms name="ortund" loginUrl="~/Login.aspx" timeout="30" slidingExpiration="true" />
</authentication>
</system.web>
<location path="Members">
<system.web>
<authorization>
<deny users="?" />
</authorization>
</system.web>
</location>
基本上它需要允许未经身份验证的用户访问网站的所有区域,除了~/Members/
以及其中的所有文件和文件夹。
目前它所做的一切只是重定向回登录页面...有没有我在这里失踪的概念?我不明白我做错了什么。
下面是登录代码:
Protected Sub lnkLogin_Click(sender As Object, e As System.EventArgs) Handles lnkLogin.Click
Dim db As New Database
' gets data from the database with the supplied credentials
' if true, the user exists, proceed to log in
If db.Login(txtEmail.Text, txtPassword.Text, "ortund") Then
FormsAuthentication.RedirectFromLoginPage(txtEmail.Text, True)
If Not String.IsNullOrEmpty(Request.Params("ReturnUrl")) Then
Response.Redirect(Request.Params("ReturnUrl"))
Else
Response.Redirect("~/Members/Default.aspx")
'Response.Redirect("~/AboutUs.aspx")
End If
Else
lblerr.Text = "Invalid username or password"
End If
End Sub
而且在Page_Load会员/ Default.aspx的:
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
If Context.User.Identity.IsAuthenticated Then
loadUserPage()
End If
End If
End Sub
据我的理解,这应该工作,允许30分钟的超时时间重置,当用户执行操作... – Ortund