Skip to content

Instantly share code, notes, and snippets.

@iamandycohen
Created July 1, 2016 18:37
Show Gist options
  • Save iamandycohen/b4b503ab5be63bb46cc1fda2a4e143ca to your computer and use it in GitHub Desktop.
Save iamandycohen/b4b503ab5be63bb46cc1fda2a4e143ca to your computer and use it in GitHub Desktop.
container.Register(Component.For<HttpContextBase>()
.UsingFactoryMethod(k =>
{
HttpContextBase httpContextBase = null;
HttpContext httpContext = HttpContext.Current;
if (httpContext != null)
{
httpContextBase = new HttpContextWrapper(HttpContext.Current);
}
return httpContextBase;
})
.LifeStyle.HybridPerWebRequestTransient());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment