mirror of
https://github.com/CoreUnion/CoreShop.git
synced 2026-10-22 16:54:26 +08:00
39 lines
986 B
C#
39 lines
986 B
C#
using Senparc.CO2NET.Utilities;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
#if NET45
|
|
using System.Web;
|
|
#else
|
|
using Microsoft.AspNetCore.Http;
|
|
#endif
|
|
|
|
namespace CoreCms.Net.WeChatService.Utilities
|
|
{
|
|
public static class Server
|
|
{
|
|
public static HttpContext HttpContext
|
|
{
|
|
get
|
|
{
|
|
#if NET45
|
|
HttpContext context = HttpContext.Current;
|
|
if (context == null)
|
|
{
|
|
HttpRequest request = new HttpRequest("Default.aspx", "https://sdk.weixin.senparc.com/default.aspx", null);
|
|
StringWriter sw = new StringWriter();
|
|
HttpResponse response = new HttpResponse(sw);
|
|
context = new HttpContext(request, response);
|
|
}
|
|
#else
|
|
HttpContext context = new DefaultHttpContext();
|
|
#endif
|
|
return context;
|
|
}
|
|
}
|
|
}
|
|
}
|