Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共4 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:移动开发函数

1楼
g1j2h3 发表于:2024/7/9 18:54:00
下边的代码为什么跳转后不显示
Dim e As RequestEventArgs = args(0)
Dim wb As New weui
Dim Verified As Boolean '用于标记用户是否通过了身份验证
Dim UserName As String = e.Cookies("username") '从cookie中获取用户名
Dim Password As String = e.Cookies("password") '从cookie中获取用户密码
If e.Path = "logon.htm" Then'如果是通过登录页面访问,从PostValues即可中提取用户名和密码
    If e.PostValues.ContainsKey("username") AndAlso e.PostValues.ContainsKey("password") Then
        UserName = e.PostValues("username")
        Password = e.PostValues("password")
    End If
End If
If UserName = "张三" AndAlso Password = "888" Then '实际使用的时候,请改为从数据库读取用户名和密码进行比较
    Verified = True
ElseIf Username = "李四" AndAlso Password = "999" Then
    Verified = True
End If
If Verified AndAlso e.Path = "logon.htm" Then '如果用户访问的是登录页,且身份验证成功
    wb.AppendCookie("username", UserName) '将用户名和密码写入cookie
    wb.AppendCookie("password", Password)
    wb.InsertHTML("<meta http-equiv='Refresh' c>") '直接跳转到首页
    e.WriteString(wb.Build) '生成网页
    Return "" '必须的
ElseIf Verified = False AndAlso e.Path <> "logon.htm" Then '如果用户身份验证失败,且访问的不是登录页面
    wb.InsertHTML("<meta http-equiv='Refresh' c>") '那么直接跳转到登录页面
    e.WriteString(wb.Build) '生成网页
    Return "" '必须的
End If

Select Case e.path
    Case "logon.htm",""
        wb.AddPageTitle("", "pageheader", "库存查询", "由XXX开发")
        If e.PostValues.ContainsKey("username") AndAlso e.PostValues.ContainsKey("password") Then '判断是否是验证失败后的重新登录
            wb.AddTopTips("", "toptip1", "用户名或密码错误!").msec = 2000 '如果用户通过登录按钮访问,则给用户一个2秒的提示.
        End If
        wb.AddForm("", "form1", "logon.htm")
        With wb.AddInputGroup("form1", "ipg1")
            .AddInput("username", "户名", "text")
            .AddInput("password", "密码", "password")
        End With
        With wb.AddButtonGroup("form1", "btg1", True)
            .Add("btn1", "登录", "submit")
        End With
    Case "exit.htm" '退出登录
        wb.DeleteCookie("username") '清除cookie中原来的用户名和密码
        wb.DeleteCookie("password")
        wb.InsertHTML("<meta http-equiv='Refresh' c>") '那么直接跳转到登录页面
    Case "", "default.htm" '首页
        wb.AddPageTitle("", "pageheader", "库存查询", "由XXX开发")
        With wb.AddGrid("", "g1")
            .Add("c1", "增加订单", "./images/button.png").Attribute = ""
            .Add("c2", "客户管理", "./images/cell.png", "http://www.foxtable.com")
            .Add("c3", "销售统计", "./images/toast.png", "http://www.foxtable.com")
            .Add("c4", "退出", "./images/exit.png", "exit.htm") '退出登录
        End With
End Select
e.WriteString(wb.Build) '生成网页
跳转后出现页面显示为
foxtable web server has started(error 404).
2楼
有点蓝 发表于:2024/7/9 20:12:00
浏览器输入的是什么地址?


另外代码不完整,重新把完整代码放到记事本发上来
3楼
g1j2h3 发表于:2024/7/9 21:52:00
浏览器地址是:127.0.0.1:8081/logon.htm
httprequest的代码是:
S elect Case e.Path
    Case "logon.htm"
        Functions.Execute("logon", e)
End S elect
跳转到default.htm的页面时出错
[此贴子已经被作者于2024/7/9 21:54:57编辑过]
4楼
有点蓝 发表于:2024/7/9 22:25:00
1、1楼【Case "logon.htm",""】改为【Case "logon.htm"
2、httprequest的代码改为:
Select Case e.Path
    Case "","logon.htm","exit.htm","default.htm"
        Functions.Execute("logon", e)
End S elect
共4 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .02734 s, 2 queries.