登录页面,输入正确的验证码,验证不成功,应该是cookies的问题,详情见下面粉色代码,麻烦看看
获取验证码、js代码发不上来,所以放在文档里
此主题相关图片如下:qq图片201111111111.png
这是登录页面login.htm代码:
Dim e As RequestEventArgs = args(0) '登录页面
Select Case e.Path
Case "login.htm"
Dim wb As New weui
If e.PostValues.Count = 0 Then
wb.AddTopTips("","toptip1","") '用于显示动态错误提示
wb.AddForm("","form1","valid_login.htm").Attribute="on-sub-mit='return validit_login()'"
With wb.AddInputGroup("form1","ipg1","登录")
If e.PostValues.ContainsKey("isj") AndAlso e.PostValues.ContainsKey("imm") Then '判断是否是验证失败后的重新登录
wb.AddTopTips("","toptip1","用户名或密码错误!").msec = 2000 '如果用户通过登录按钮访问,则给用户一个2秒的提示.
End If
With .AddInputCell("ic1") '通过InputCell增加输入框(1表示突出显示,2表示红色警示图标)
.AddLabel("lsj","手机",0) '增加标签(0显示在左边)
.AddInput("isj","text",1).PlaceHolder= "请输入手机号" '增加输入框(0靠左显示,1居中显示,2靠右显示)
End With
With .AddInputCell("ic2")
.AddLabel("lmm","密码",0)
.AddInput("imm","password",1).PlaceHolder= "请输入密码"
End With
With .AddInputCell("ic5") '通过InputCell增加输入框
.AddLabel("lyzm","验证码",0) '增加标签,0显示在左边
.AddInput("yzm","text",1) '增加输入框,1表示显示在中间
.AddImage("pim","/getVimg.htm",2).Attribute="o-n-click=""this.src = 'getVimg.htm?rand=' + Math.random() """ '增加一个图片,2比表示显示在右边
End With
'End With
.AddSwitch("jizhumima","记住密码")
With wb.AddButtonGroup("form1","btg1",True)
.Add("btn1", "登录","submit") '"/index.htm")
End With
With wb.AddButtonGroup("form1","btg2", False)
.Add("btn2", "免费注册","","/register.htm").Kind = 1
.Add("btn3", "忘记密码","","/getback.htm").Kind = 1
End With
End With
wb.AppendHTML("<s-crip-t src='./lib/ajaxform_login.js'></script>") '引入脚本文件
e.WriteString(wb.Build) '生成网页
End If
End Select
这是登录验证valid_login.htm页面代码:
Dim e As RequestEventArgs = args(0) '验证页面(登录页面)
Select Case e.Path
Case "valid_login.htm"
Dim wb As New weui
Dim cookie_yzm As String = e.Cookies("msg") '从cookie中获取验证码
msgbox(e.Cookies("msg")) ’窗口弹出,无值
msgbox(cookie_yzm) ‘同上
Dim yanzm As String = e.PostValues("yzm") '验证_验证码
Dim jizmm As String = e.PostValues("jizhumima") '验证服务协议
If yanzm = "" Then
e.WriteString("验证码不能为空!")
Return ""
ElseIf yanzm <> "" AndAlso yanzm.Length <> 4 Then
e.WriteString("请输入正确的验证码!")
Return ""
ElseIf yanzm <> " & cookie_yzm & " Then
msgbox(123) ‘窗口弹出123 ’
e.WriteString("请输入正确的验证码!")
Return ""
End If
End Select
[此贴子已经被作者于2017/3/23 15:34:44编辑过]