container.Register(Component.For<HttpContext>().Lifecycle.Transient().UsingFactoryMethod(kernel => HttpContext.Current));
I would use a set of adapters to abstract the http context. this way you are not fully dependent on the context. example
interface ICurrentUser
{
string UserName {get;}
bool IsInRole(string role);
}
class CurrentUser : ICurrentUser
{
public HttpContext Context {get;set;}
public string UserName {get{ return
Context.User.Identity.Name;}}
public bool IsInRole(string role)
{
return Context.User.IsInRole(role);
}
}
something similar can be done for request, response, session, etc.