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.

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/castle-project-users/-/SKDrbTvDmAMJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en.

Reply via email to