Foxtable(狐表)用户栏目专家坐堂 → 网页设计cookie问题


  共有2061人关注过本帖树形打印复制链接

主题:网页设计cookie问题

帅哥哟,离线,有人找我吗?
ycs5801
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:911 积分:6617 威望:0 精华:0 注册:2009/6/24 9:44:00
网页设计cookie问题  发帖心情 Post By:2021/2/27 15:08:00 [只看该作者]

Dim e As RequestEventArgs = args(0)
Dim wb As New WeUI
Dim dr As DataRow=DataTables("报关员").sqlfind("手机号='" & e.Cookies("username")  & "'")

If dr IsNot Nothing  AndAlso  dr("密码")=e.Cookies("password")  Then  '''如果有此用户,且密码正确.    
   
    With wb.AddGrid("","g1")
        .Add("c1","Button", "./images/button.png").Attribute = ""
        .Add("c2","Cell", "./images/cell.png", "http://www.foxtable.com")
        .Add("c3","Toast", "./images/toast.png", "http://www.foxtable.com")
        .Add("c4","Dialog", "./images/dialog.png", "http://www.foxtable.com")
        .Add("c5","Progress", "./images/progress.png", "http://www.foxtable.com")
        .Add("c6","Msg", "./images/msg.png", "http://www.foxtable.com")
        .Add("c7","Article", "./images/article.png", "http://www.foxtable.com")
        .Add("c8","ActionSheet", "./images/actionSheet.png", "http://www.foxtable.com")
        .Add("c9","Icons", "./images/icons.png", "http://www.foxtable.com")
        .Add("c10","Panel", "./images/panel.png", "http://www.foxtable.com")
        .Add("c11","Tab", "./images/tab.png", "http://www.foxtable.com")
        .Add("c12","SearchBar", "./images/search.png", "http://www.foxtable.com")
    End With
e.WriteString(wb.Build)
Else
    wb.AppendHTML("<meta http-equiv='Refresh' c>")
End If


Dim dr As DataRow=DataTables("报关员").sqlfind("手机号='" & e.Cookies("username")  & "'")

If dr IsNot Nothing  AndAlso  dr("密码")=e.Cookies("password")  Then  '''如果有此用户,且密码正确.    

这句代码是否正确?现在我无法提取到cookie值,直接就转到login页面了。

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106209 积分:540168 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2021/2/27 17:01:00 [只看该作者]

登录的时候是怎么保存cookie的?

 回到顶部
帅哥哟,离线,有人找我吗?
ycs5801
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:911 积分:6617 威望:0 精华:0 注册:2009/6/24 9:44:00
这样  发帖心情 Post By:2021/2/27 17:58:00 [只看该作者]

 Dim dr As DataRow=DataTables("报关员").sqlfind("手机号='" & e.postvalues("手机号") & "'")
    If dr IsNot Nothing Then  '''如果有此用户,那么继续判断.
        If dr("密码")=e.postvalues("密码") Then '''判断密码是否正确
wb.AppendCookie("username",e.postvalues("手机号"), 43200)
wb.AppendCookie("password",e.postvalues("密码") ,43200)


 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106209 积分:540168 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2021/2/28 20:07:00 [只看该作者]

贴出3楼代码所在事件的完整代码看看。

自己调试一下

Dim dr As DataRow=DataTables("报关员").sqlfind("手机号='" & e.postvalues("手机号") & "'")
    If dr IsNot Nothing Then  '''如果有此用户,那么继续判断.
        If dr("密码")=e.postvalues("密码") Then '''判断密码是否正确
msgbox(e.postvalues("手机号"))
msgbox(e.postvalues("密码"))
wb.AppendCookie("username",e.postvalues("手机号"), 43200)
wb.AppendCookie("password",e.postvalues("密码") ,43200)

------------

Dim e As RequestEventArgs = args(0)
Dim wb As New WeUI
msgbox(e.Cookies("username"))
msgbox(e.Cookies("password"))
Dim dr As DataRow=DataTables("报关员").sqlfind("手机号='" & e.Cookies("username")  & "'")

If dr IsNot Nothing  AndAlso  dr("密码")=e.Cookies("password")  Then  '''如果有此用户,且密码正确.    
   

 回到顶部