1.进入其他页面提示1、2、8
2.下面粉色部分需要给2分钟时间,一样进入登录页面
下面是httprequest事件代码:
If e.Path = "login.htm" OrElse e.Path = "personal.htm" Then
Dim wb As New weui
msgbox(1)
'身份验证
Dim Verified As Boolean '用于标记用户是否通过了身份验证
Dim UserName As String = e.Cookies("isj") '从cookie中获取用户名
Dim Password As String = e.Cookies("imm") '从cookie中获取用户密码
msgbox(2)
If e.Path = "login.htm" '如果是通过登录页面访问,从PostValues即可中提取用户名和密码
msgbox(3)
If e.PostValues.ContainsKey("isj") AndAlso e.PostValues.ContainsKey("imm") Then
msgbox(4)
UserName = e.PostValues("isj")
Password = e.PostValues("imm")
End If
End If
If e.Cookies.ContainsKey("isj") = False OrElse e.Cookies.ContainsKey("imm") = False Then
msgbox(5)
Dim dr As DataRow = DataTables("会员资料").sqlFind("手机 = '" & UserName & "'")
If dr IsNot Nothing AndAlso dr("密码") = Password Then
msgbox(6)
Verified = True
End If
End If
If Verified AndAlso e.Path = "login.htm" Then '如果用户访问的是登录页,且身份验证成功
msgbox(7)
wb.AppendCookie("isj",UserName) '将用户名和密码写入cookie
wb.AppendCookie("imm",Password)
wb.InsertHTML("<meta http-equiv='Refresh' c>") '直接跳转到首页
e.WriteString(wb.Build) '生成网页
Return '必须的
ElseIf Verified = False AndAlso e.Path <> "login.htm" Then '如果用户身份验证失败,且访问的不是登录页面
msgbox(8)
wb.InsertHTML("<meta http-equiv='Refresh' c>") '那么直接跳转到登录页面
e.WriteString(wb.Build) '生成网页
Return '必须的
End If
Select Case e.Path
Case "personal.htm" '个人中心
Functions.Execute("personal",e)
Case "login.htm" '登录页面
Functions.Execute("login",e)
end select
[此贴子已经被作者于2017/3/28 12:04:08编辑过]