Equivalent to ASP.NET WebForms URL Authorization in MVC

777 views Asked by At

We're considering making the move from WebForms to MVC for our (quite substantial) intranet application.

The intranet app currently uses Windows authentication. Authorization to particular folders is controlled by web.config files inside each folder. The app also uses a Menu control which picks all this up and only shows users menu links to pages they are authorised to view. All this functionality comes out of the box with WebForms.

In terms of the conversion to MVC, I think that replacing this functionality is going to be one of the key challenges.

Can anyone tell me what tools are available in MVC to:

  1. restrict users' access to certain pages / views whatever based on their Active Directory group membership
  2. generate markup for a menu which is aware of the users' authorisation to certain pages / views

That would be mighty helpful.

2

There are 2 answers

0
Darin Dimitrov On

restrict users' access to certain pages / views whatever based on their Active Directory group membership

Decorating the controller action with the [Authorize] attribute.

generate markup for a menu which is aware of the users' authorisation to certain pages / views

Depending on your exact requirements you could build a custom HTML helper. You may also take a look at MVCContrib MenuBuilder.