以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]微信接口配置失败  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=131790)

--  作者:无限5180
--  发布时间:2019/3/6 17:03:00
--  [求助]微信接口配置失败
老师: 按照帮助文件在httpRequest事件中设置如下代码
    Select Case e.path
        Case "wefox.htm"   \'登录页面
    \'e.WriteString("你好")
            If e.Request.HttpMethod.ToUpper = "GET"
                If Functions.Execute("VerifySignature",e) Then
                    e.WriteString(e.GetValues("echostr"))
                End If
            End If
    End Select
设置名为"VerifySignature"的函数
Dim e As RequestEventArgs = Args(0)
Dim token = "***" \'必须和设置的Token相同
Dim signature As String = e.GetValues("signature")
Dim timestamp As String = e.GetValues("timestamp")
Dim nonce As String = e.GetValues("nonce")
Dim echostr As String = e.GetValues("echostr")
Dim aryTmp() As String = {token,timestamp,nonce}
Array.Sort(aryTmp)
Dim strTmp As String = String.Join("", aryTmp)
strTmp = Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(strTmp, "SHA1")
Return signature = strTmp.ToLower

通过网页访问,msgbox显示能正常访问
但提交显示"配置失败"

图片点击可在新窗口打开查看此主题相关图片如下:配置失败.png
图片点击可在新窗口打开查看

这是怎么回事呢?

--  作者:有点蓝
--  发布时间:2019/3/6 17:07:00
--  
测试号是不加密的,直接返回

Select Case e.path
        Case "wefox"   \'登录页面
e.WriteString(e.GetValues("echostr"))
    End Select

--  作者:无限5180
--  发布时间:2019/3/6 17:20:00
--  回复:(有点蓝)测试号是不加密的,直接返回Select C...
测试号是不加密的,直接返回

Select Case e.path
        Case "wefox"   \'登录页面
e.WriteString(e.GetValues("echostr"))
    End Select


按照这个代码,"Token"写在哪儿呢? 微信提交,Token不能为空


--  作者:有点蓝
--  发布时间:2019/3/6 17:22:00
--  
    Select Case e.path
        Case "wefox"   \'登录页面
            If e.Request.HttpMethod.ToUpper = "GET"
                If Functions.Execute("VerifySignature",e) Then
                    e.WriteString(e.GetValues("echostr"))
                End If
            End If
    End Select

--  作者:无限5180
--  发布时间:2019/3/6 17:35:00
--  
老师,这个代码好像我发的问题提交的代码一样呀,还是配置失败
    Select Case e.path
        Case "wefox"   \'登录页面
            If e.Request.HttpMethod.ToUpper = "GET"
                If Functions.Execute("VerifySignature",e) Then
                    e.WriteString(e.GetValues("echostr"))
                End If
            End If
    End Select

--  作者:有点甜
--  发布时间:2019/3/6 17:39:00
--  

在你的httprequest那里加入msgbox(e.path)

 

当你点击提交的时候,能否弹出对应窗口?


--  作者:无限5180
--  发布时间:2019/3/6 17:40:00
--  
不好意思,老师,应该是我这边的问题,已经成功了,谢谢!
--  作者:有点甜
--  发布时间:2019/3/6 17:40:00
--  

如果还有问题,请这样配置测试环境

 

http://www.sunnyos.com/article-show-67.html

 

https://www.ngrok.cc/

 


--  作者:无限5180
--  发布时间:2019/3/6 19:47:00
--  回复:(有点甜)如果还有问题,请这样配置测试环境...
谢谢老师,正是需要的.