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 9225177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:30:48+00:00 2026-06-18T04:30:48+00:00

In ASP.NET you can decorate a method as such [Authorize(Roles=Moderator,Tester)] Function ActionResult Foo() {

  • 0

In ASP.NET you can decorate a method as such

[Authorize(Roles="Moderator,Tester")]
Function ActionResult Foo()
{
   return View();
}

This will limit access to users that are in one of the roles specified.

I have a requirement where the user must be in all the roles specified. I can create a new role for this; But I was wondering if it is possible to decorate the method such, that the user must be part of all the roles specified?

Is this possible using the Authorise attribute or will I need to create my own?

  • 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-06-18T04:30:49+00:00Added an answer on June 18, 2026 at 4:30 am

    Simply use The [Authorize] attribute multiple times:

    [Authorize(Roles="Moderator")]
    [Authorize(Roles="Tester")]
    Function ActionResult Foo()
    {
       return View();
    }
    

    This will require the user to be in both (or more) roles.

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

Sidebar

Related Questions

How can I decorate my ASP.NET MVC ViewModel property to render as a textarea
I have a ASP.NET web service decorated with System.Web.Script.Services.ScriptService() so it can return json
Using ASP.NET MVC can be used the view engine Razor. Razor let you use
With the new ASP.NET MVC 2 validation features, we can decorate the properties of
I like ASP.Net MVC Authorize attribute, I can extend it and build my own
In my ASP.NET MVC app, I have most controllers decorated with [Authorize(Roles=SomeGroup)] When a
In asp.net we can save post back data using view state i.e for client
I have this exact issue ASP.net can’t update page from event handler and it's
Is there any limit that application state in asp.net can store ?? Am trying
ASP.NET MVC can generate HTML elements using HTML Helpers, for example @Html.ActionLink() , @Html.BeginForm()

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.