I am trying to make a simple scalable web system, and after looking around a bit it seems that forms authentication with cookies is what im looking for, as I do not need a session for storing login related data.
I have recently plumbed in that part of the system and noticed that the authorise attribute was not doing anything. After a look around the internet it seems that Ninject is causing the issue as it doesn't handle the attribute correctly.
Now if this is the case and it doesn't allow me to use the built in authentication mechanism how am I meant to get the same functionality that authorize would normally give me, without having to write my own authentication system?
As currently it looks like I would have to make my own CustomAuthorizationAttribute and then make a filter with that, which I am happy to do, but I cannot find how to get this to defer to the FormsAuthentication mechanism. Also this only se开发者_如何转开发ems to work on a controller level, not at an action level.
I had the similar issue just now (that's how I found your question).
After some googling, I tried moving my IKernel
setup code from Global.asax
to App_Start\NInjectMVC3.cs
, and it miraculously worked.
I'm not sure what caused the initial issue though.
I use Ninject + MVC3 + Authorize attributes with ASP.NET forms authentication using cookies. Everything works as it should.
What do you mean by "the authorize attribute isn't doing anything?" Do you have your membership providers set up in your web.config file?
精彩评论