Mini.Crm/Mini.Web/WebHelper/MyHttpContext.cs

26 lines
648 B
C#

using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Mini.Web.WebHelper
{
public class MyHttpContext
{
public static IServiceProvider ServiceProvider;
static MyHttpContext()
{ }
public static HttpContext Current
{
get
{
object factory = ServiceProvider.GetService(typeof(Microsoft.AspNetCore.Http.IHttpContextAccessor));
HttpContext context = ((IHttpContextAccessor)factory).HttpContext;
return context;
}
}
}
}