msgbox(openid)
'不管使用e.AppendCookie还是wb.AppendCookie,都能弹出正确的openid,授权正常。
'使用wb.AppendCookie,每次登录,"dd"页面都无法获取到openid。
'使用e.AppendCookie,第1次登录"dd"页面,无法获取到这个openid,第2次及后面的登录能获取到openid。
End If
Else
OpenId = e.Cookies("openid")
msgbox(OpenId) 调试看看
msgbox(e.path)
End If
Dim Verified As Boolean
Dim dr As DataRow = DataTables("Users").SQLFind("[openid] ='" & OpenID & "' and [离职] = 0")
If OpenId > "" AndAlso dr IsNot Nothing Then
Verified = True
ElseIf e.GetValues.ContainsKey("code") = False Then
Dim ul As String = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxd01***&redirect_uri=" & UrlEncode(e.Request.URL.ToString) & "&response_type=code&scope=snsapi_base&state=123#wechat_redirect"
sb.Append("<meta http-equiv='Refresh' c o n t e n t='0; url=" & ul & "'>")
e.WriteString(sb.ToString)
Return '必须的
End If
If Verified = False Then
wb.InsertHTML("<meta http-equiv='Refresh' c>") '直接跳转到登录页,显示无登录权限(需要输入密码).
e.WriteString(wb.Build) '生成网页
Return '必须的
ElseIf e.path = "" Then '从登录页访问
wb.InsertHTML("<meta http-equiv='Refresh' c>") '直接跳转到首页 这里设置的就是dd.htm?
e.WriteString(wb.Build) '生成网页
Return '必须的
End If
End If