﻿using System;
using System.Web;

namespace Umbraco.Web
{
    internal class AspNetHttpContextAccessor : IHttpContextAccessor
    {
        public HttpContextBase HttpContext
        {
            get
            {
                return new HttpContextWrapper(System.Web.HttpContext.Current);
            }
            set
            {
                throw new NotSupportedException();
            }
        }
    }
}

﻿using System;
using System.Web;

namespace Umbraco.Web
{
    internal class AspNetHttpContextAccessor : IHttpContextAccessor
    {
        public HttpContextBase HttpContext
        {
            get
            {
                var httpContext = System.Web.HttpContext.Current;
                return httpContext is null ? null : new HttpContextWrapper(httpContext);
            }
            set
            {
                throw new NotSupportedException();
            }
        }
    }
}

Fix if httpContext is null we cannot wrap it
Fix if httpContext is null we cannot wrap it
