Foxtable(狐表)用户栏目专家坐堂 → [讨论]大神能否转一下C#微信红包的源码为狐表可用


  共有3353人关注过本帖树形打印复制链接

主题:[讨论]大神能否转一下C#微信红包的源码为狐表可用

帅哥哟,离线,有人找我吗?
有点甜
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/1/24 15:41:00 [显示全部帖子]

如果想转,参考

 

http://converter.telerik.com/

 


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/1/25 21:50:00 [显示全部帖子]

1、全局代码

 

Public Function CheckValidationResult(sender As Object, certificate As System.Security.Cryptography.X509Certificates.X509Certificate, chain As System.Security.Cryptography.X509Certificates.X509Chain, errors As System.Net.Security.SslPolicyErrors) As Boolean
 ' 总是接受   
 Return True
End Function

 

 

2、参考

 

dim bytes
dim requrl = "https://api.mch.weixin.qq.com/secapi/pay/refund"

Dim cert As String = "C:\cert\apiclient_cert.p12"
Dim password As String = "商户号"
System.Net.ServicePointManager.ServerCertificateValidationCallback = New System.Net.Security.RemoteCertificateValidationCallback(addressof CheckValidationResult)

Dim cer As System.Security.Cryptography.X509Certificates.X509Certificate = New System.Security.Cryptography.X509Certificates.X509Certificate(cert, password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags.MachineKeySet)
Dim webrequest As net.HttpWebRequest = net.HttpWebRequest.Create(reqUrl)
webrequest.ClientCertificates.Add(cer)
webrequest.Method = "post"

webrequest.ContentLength = bytes.Length
webrequest.GetRequestStream().Write(bytes, 0, bytes.Length)
Dim webreponse As Net.httpWebResponse = webrequest.GetResponse()
Dim stream As io.Stream = webreponse.GetResponseStream()
Dim resp As String = String.Empty
Using reader As io.StreamReader = New io.StreamReader(stream)
resp = reader.ReadToEnd()
End Using


 回到顶部