以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 服务号里,接入验证token失败 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=150039) |
-- 作者:zhangjian222200 -- 发布时间:2020/5/19 11:01:00 -- 服务号里,接入验证token失败 服务号内开发基本配置,接入显示验证token失败,见下图 httprequest代码: Select Case e.Path Case "wefox" If Functions.Execute("VerifySignature",e) = False Then Return End If end select VerifySignature代码: Dim e As RequestEventArgs = Args(0) Dim token = "123456" \'必须和设置的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 [此贴子已经被作者于2020/5/19 12:57:57编辑过]
|
-- 作者:有点蓝 -- 发布时间:2020/5/19 11:48:00 -- 公众号回调哪里是怎么设置的? 照抄帮助的代码,看不懂就不要随便改 然后将HttpRequet事件代码改为:
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 [此贴子已经被作者于2020/5/19 13:40:52编辑过]
|
-- 作者:zhangjian222200 -- 发布时间:2020/5/19 12:58:00 -- 链接参照官方文档+楼上 可以了
|