以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  微信cookie存储时长  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=177377)

--  作者:4869468
--  发布时间:2022/5/19 14:45:00
--  微信cookie存储时长
If Verified AndAlso e.Path = "logon.htm"  Then \'如果用户访问的是登录页,且身份验证成功
    wb.AppendCookie("username",UserName,525600) \'将用户名和密码写入cookie,有效期1年
    wb.AppendCookie("password",Password,525600)
    wb.InsertHTML("<meta http-equiv=\'Refresh\' c>") \'直接跳转到首页
    e.WriteString(wb.Build) \'生成网页
    Return \'必须的
ElseIf Verified = False AndAlso e.Path <> "logon.htm" Then \'如果用户身份验证失败,且访问的不是登录页面
    wb.DeleteCookie("code")
    wb.AppendCookie("code",e.Values("code"))
    wb.InsertHTML("<meta http-equiv=\'Refresh\' c>") \'那么直接跳转到登录页面
    e.WriteString(wb.Build) \'生成网页
    Return \'必须的
End If
=============================
设置了cookie有效期1年,用了近一个月吧,在电脑浏览器上正常,从没叫重新登录。但在微信内置浏览器登录,不清楚具体时间,反正是过几天又要重新登录。如何微信也能保存cookie一年

--  作者:有点蓝
--  发布时间:2022/5/19 14:55:00
--  
这个要问腾讯才知道了。使用公众号授权功能咯,判断openid