KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm writing a custom Authorization Filter for asp.net mvc 3. I need to inject a userservice into the class but I have no idea how to do this. public class AuthorizeAttribute : FilterAttribute, IAuthorizationFilter { private IUserService userService; private string[] roles; public AuthorizeAttribute(params string[] roles) { this.roles = roles; } public void OnAuthorization(AuthorizationContext filterContext) { throw new NotImplementedException(); } } I'm using ninject for dependency injection. I do not want to use a Factory or service locator pattern. My bindings look like this in the global.acsx: internal class SiteModule : NinjectModule { public override void Load() { Bind<IUserService>().To<UserService>(); } }
Tags (comma-separated)
Save Edits
Cancel