我已經設置了驗證基於我從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