Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6587405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:54:46+00:00 2026-05-25T16:54:46+00:00

I am attempting to authorise users against Active Directory in my ASP .NET MVC3

  • 0

I am attempting to authorise users against Active Directory in my ASP .NET MVC3 web application. Not only do I want force the user to login and authorise that against the users in the directory, but I also want to authorise users against the groups they are in, along the lines of this:

[Authorize(Roles = @"DOMAIN\Group")]

Every example I’m seeing does it for Windows authentication. I am using Forms authentication. The important parts of my Web.config are as follows:

<add name="ADConnectionString" connectionString="LDAP://blahblahblah" />

<authentication mode="Forms">
  <forms name="AD" loginUrl="~/Account/LogOn" />
</authentication>

<membership defaultProvider="ADMembershipProvider">
  <providers>
    <clear />
    <add name="ADMembershipProvider" 
         type="System.Web.Security.ActiveDirectoryMembershipProvider" 
         connectionStringName="ADConnectionString"
         attributeMapUsername="sAMAccountName" />
  </providers>
</membership>

<roleManager enabled="true" defaultProvider="AspNetWindowsTokenRoleProvider">
  <providers>
    <clear />
    <add name="AspNetWindowsTokenRoleProvider"
         type="System.Web.Security.WindowsTokenRoleProvider"
    />
  </providers>
</roleManager>

I currently get an error that says

Method is only supported if the user name parameter matches the user
name in the current Windows Identity.

Is it possible to do this using Forms authentication and how should I configure my app?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T16:54:47+00:00Added an answer on May 25, 2026 at 4:54 pm

    From my research, it seems that the answer is no, you can’t use Forms authentication with a WindowsTokenRoleProvider. See here:

    How can I provide an ASP.NET Forms Authentication UX while using Active Directory Role and Authentication providers?

    Instead I have done what I did in ASP .NET MVC 2 which is to implement my own AuthorizeAttribute:

    ASP .NET MVC Forms authorization with Active Directory groups

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to authenticate using users and groups in ASP.NET MVC against Active Directory.
I'm attempting to retrofit an intranet-only ASP.NET webapp with some rudimentary security. I have
I am using windows authentication in a ASP.Net Web Application and in the code-behind
I'm attempting to use jqGrid in my ASP.Net MVC application and have a requirement
I'm attempting to create an ASP.NET/C# page that runs a PowerShell script that will
Attempting to find printers / shares in Active Directory using C#. This is my
Attempting to use asp.net mvc's Action Result of File. So it would seem that
I'm attempting to setup a new .NET application using Tridion 2011 SP1 and Smart
I am attempting to create a PHP SOAP connection to a .NET Web Service
I'm attempting to use the new partial page caching available in ASP.NET MVC 3.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.