开发者

Non physical location authorization in IIS6

开发者 https://www.devze.com 2023-01-13 21:54 出处:网络
I\'m running an Asp.NET MVC 2 app under IIS 6. All pages are behind Windows Integrated Authentication except for some pages that accepts anonymous access.

I'm running an Asp.NET MVC 2 app under IIS 6. All pages are behind Windows Integrated Authentication except for some pages that accepts anonymous access.

We setup these pages in the web.config with the location element like this

<location pat开发者_运维技巧h="MyPath/ToThePage">
    <system.web>
      <authorization>
        <allow users="*"/>
      </authorization>
    </system.web>
  </location>

Since this is an Asp.NET MVC app, the path indicated in the path attribute points to an action method not a physical location.

When this was running under IIS 7 integrated mode it was working fine. But when we switched to IIS 6 we get the login prompt even with the pages that are set to accept anonymous users.

How to make IIS 6 authorize anonymous access to non physical paths ?


If you are using a MembershipProvider you could simply use ActionFilter-tags for realizing your access-restrictions:

<Authorize()> _
Function NotAllowedSuccess() As ActionResult
    Return View(Base)
End Function

Would result in a restricted path... more infos:

  • http://msdn.microsoft.com/de-de/library/sy​stem.web.mvc.authorizeattribute.a​spx (currently the website is offline... but maybe it's working later)
  • Blog entry about customization
0

精彩评论

暂无评论...
验证码 换一张
取 消