以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  微信公众号测试提价token重提示 URL超时  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=148681)

--  作者:lemonkashi
--  发布时间:2020/4/13 11:32:00
--  微信公众号测试提价token重提示 URL超时
微信公众号测试提价token重提示 请求URL超时

服务器端代码如下:
Select Case e.path
    Case "wefox" ,"wefox1"
        Dim token = "weixinlemon" \'必须和设置的Token相同
        \'messagebox.Show("weixinlemon")
        Dim signature As String = e.Values("signature")
        Dim timestamp As String = e.Values("timestamp")
        Dim nonce As String = e.Values("nonce")
        Dim echostr As String = e.Values("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")
        If signature = strTmp.ToLower() Then
              e.WriteString(echostr)
        End If
End Select


查看了一下微信帮助文档 写的如下

private function checkSignature()
{
    $signature = $_GET["signature"];
    $timestamp = $_GET["timestamp"];
    $nonce = $_GET["nonce"];
	
    $token = TOKEN;
    $tmpArr = array($token, $timestamp, $nonce);
    sort($tmpArr, SORT_STRING);
    $tmpStr = implode( $tmpArr );
    $tmpStr = sha1( $tmpStr );
    
    if( $tmpStr == $signature ){
        return true;
    }else{
        return false;
    }
}

 需要将  e.WriteString(echostr) 改成  return true; ?


找不到原因了  请蓝老师指点  谢谢。


--  作者:有点蓝
--  发布时间:2020/4/13 11:51:00
--  
echostr没有关系

截图看看微信的设置

外网能够访问这个服务器吗?是不是开启的80端口?把地址放到外网的电脑浏览器里测试能不能访问服务器

--  作者:lemonkashi
--  发布时间:2020/4/13 12:00:00
--  
外放可以访问这个服务器,我一直在远程登录这个电脑。访问http://www.clouddoctor.club/wefox 测试连通的。
--  作者:lemonkashi
--  发布时间:2020/4/13 12:02:00
--  

[此贴子已经被作者于2020/4/13 13:15:28编辑过]

--  作者:有点蓝
--  发布时间:2020/4/13 12:10:00
--  
httprequest事件还有没有其它代码?整个事件代码发上来看看
--  作者:lemonkashi
--  发布时间:2020/4/13 12:15:00
--  
服务器端代码就是这些 基本是在帮助文档里面贴出来的
Select Case e.path
    Case "wefox" ,"wefox1"
        Dim token = "weixinlemon" \'必须和设置的Token相同
        \'messagebox.Show("weixinlemon")
        Dim signature As String = e.Values("signature")
        Dim timestamp As String = e.Values("timestamp")
        Dim nonce As String = e.Values("nonce")
        Dim echostr As String = e.Values("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")
        If signature = strTmp.ToLower() Then
              e.WriteString(echostr)              
        End If
End Select

--  作者:lemonkashi
--  发布时间:2020/4/13 13:17:00
--  
刚刚反复测试 一下突然又行了,不知道是不是微信配置界面每次提交都要先刷新的事情。