asp.net mvc - limit access to web pages

Posted by niao on Stack Overflow See other posts from Stack Overflow or by niao
Published on 2010-03-27T16:50:07Z Indexed on 2010/03/27 16:53 UTC
Read the original article Hit count: 176

Filed under:

Greetings, in my asp.net mvc application what i would like to do is to enable access to some pages only after user was successfully authorized. I have already created custom membership provider and that works fine. How can I, in web config create such rule - for instance for all pages in ~Admin/ folder? I don't want to create on every controller's action the validation code. For now i have in my web.config the following statement:

    <location path="~/Admin"> 
<system.web>
  <authorization>
    <deny users="?"/> 
  </authorization>
</system.web>

but it doesn't work.

© Stack Overflow or respective owner

Related posts about asp.net-mvc