24 lines
680 B
C#
24 lines
680 B
C#
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace Nirvana.Common
|
|
{
|
|
public static class MyHttpContext
|
|
{
|
|
public static IServiceCollection serviceCollection;
|
|
|
|
public static Microsoft.AspNetCore.Http.HttpContext current
|
|
{
|
|
get
|
|
{
|
|
object factory = serviceCollection.BuildServiceProvider().GetService(typeof(IHttpContextAccessor));
|
|
Microsoft.AspNetCore.Http.HttpContext context = ((HttpContextAccessor)factory).HttpContext;
|
|
return context;
|
|
}
|
|
}
|
|
}
|
|
}
|