DTcms.API/DTcms.API.Payment.wxpay/HttpService.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.IO;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading;
namespace DTcms.API.Payment.wxpay
{
public class HttpService
{
public static bool CheckValidationResult(object sender, System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Security.Cryptography.X509Certificates.X509Chain chain, System.Net.Security.SslPolicyErrors errors)
{
return true;
}
public static string Post(string xml, string url, bool isUseCert, int timeout)
{
System.GC.Collect();
string result = "";
System.Net.HttpWebRequest request = null;
System.Net.HttpWebResponse response = null;
try
{
System.Net.ServicePointManager.DefaultConnectionLimit = 200;
if (url.StartsWith("https", System.StringComparison.OrdinalIgnoreCase))
{
System.Net.ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(HttpService.CheckValidationResult);
}
request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(url);
request.Method = "POST";
request.Timeout = timeout * 1000;
request.ContentType = "text/xml";
byte[] data = System.Text.Encoding.UTF8.GetBytes(xml);
request.ContentLength = (long)data.Length;
System.IO.Stream reqStream = request.GetRequestStream();
reqStream.Write(data, 0, data.Length);
reqStream.Close();
response = (System.Net.HttpWebResponse)request.GetResponse();
System.IO.StreamReader sr = new System.IO.StreamReader(response.GetResponseStream(), System.Text.Encoding.UTF8);
result = sr.ReadToEnd().Trim();
sr.Close();
}
catch (System.Threading.ThreadAbortException e_E5)
{
System.Threading.Thread.ResetAbort();
}
catch (System.Net.WebException e)
{
throw new WxPayException(e.ToString());
}
catch (System.Exception e2)
{
throw new WxPayException(e2.ToString());
}
finally
{
if (response != null)
{
后面还有 57 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。