I'm trying to mix some MVC3 functionality into an existing WebForms application. I've followed a few guides, and got everything set up and working except for the authorization piece. The existing application has <deny users="*" />
sitting at the root web.config, and each subfolder has its own web.config that allows access to the pages within for specific roles.
My new understanding is that this style of can't/shouldn't be used on Controllers, and I should be using Authorize
attributes instead. I've decorated my test "HomeController
" class with [Authorize(Roles="AdminRole")]
, but I get an "Access Denied" page when I attempt to view the page.
If i change the root web.config to say <allow users="*" />
, the page works. Does this mean that the attribute I added to the controller is working, but the root web.config setting is taking precedence over it? I don't want to mess with our existing authorization stuff since the site is well established and I'm just trying to add MVC in to play with. Am I missing something? Thanks for any insight you can provide.