views:

143

answers:

0

I have two level authentification, first the user enters their nt/password and it is validated by LDAP and afterward I have a custom role provider that make sure the user has access to said page.

That being said, in my web.config I have:

<authentication mode="Forms">
  <forms loginUrl="~/Account.mvc/LogOn" timeout="2880"/>
</authentication>
<authorization>
  <deny users="?"/>
</authorization>
<membership defaultProvider="ADMembershipProvider">
  <providers>
    <add connectionStringName="ADConnString"
         name="ADMembershipProvider"
         type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
         attributeMapUsername="sAMAccountName"
         enableSearchMethods="false"
         applicationName="ProgramName"/>
  </providers>
</membership>
<roleManager enabled="true" defaultProvider="CustomRoleProvider">
  <providers>
    <clear />
    <add name="CustomRoleProvider"
         applicationName="ProgramName"
         type="ProgramName.Providers.CustomRoleProvider"
         attributeMapUsername="sAMAccountName"
         />
  </providers>
</roleManager>

Now, If I try to use the language button while in the login form, it calls an action that is unavailable since the user still isn't LDAP-Authenticated. My question is:

Can I avoid the membership check for specific action like I can for role check using the [Authorize] Attribute?

I tried using:

  <location path="~/Home.mvc/ChangeCulture">
    <system.web>
      <authorization>
        <allow users="*"/>
      </authorization>
    </system.web>
  </location>

And this doesn't work. The action ChangeCulture is never called.

This answer:

http://stackoverflow.com/questions/1816625/asp-net-mvc-forms-authentication-and-unauthenticated-controller-actions

shows how to do it for roles, any idea for membership+roles?

Thanks.

related questions