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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:16:12+00:00 2026-05-28T08:16:12+00:00

On an intranet site using windows authentication, and certain controller methods being marked with

  • 0

On an intranet site using windows authentication, and certain controller methods being marked with the “AuthorizeAttribute” controlling access to certain users/groups and roles, I’m trying to figure out the best way to allow “test users” to access these things.

Since <location> is off the table with MVC (security concerns), what is the best approach here?

My first thought is to implement the following:

  1. A custom config section that essentially mirrors the <authorization> section
  2. A custom attribute that inherits from “AuthorizeAttribute” which checks users against the custom config section
  3. Use config transforms to remove the custom config section for QA and Release environments

Is there an easier/better way???

  • 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-28T08:16:12+00:00Added an answer on May 28, 2026 at 8:16 am

    Update
    What I originally wrote used the attribute syntax on a class or method, but if you are using MVC3 you can also use a global action filter in (global.asax.cs) so you only have to do it once.

    public static void RegisterGlobalFilters(GlobalFilterCollection filters)
    {
    #if DEBUG
        filters.Add(new AuthorizeAttribute() {Users="YourAccount"});
    #endif
        //Your other global action filters
    }
    

    Original
    You could use #if DEBUG to only add the authorization to debug code.

    #if DEBUG
        [Authorize(Users = "YourAccount")]
    #endif
    

    The Authorize attribute allows multiple so you don’t have to repeat your production authorized user list or use an #else.

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

Sidebar

Related Questions

I'm developing an ASP.NET application for an intranet site that is using Windows/NTLM/WIA/whatever authentication.
I have an Intranet site reading the windows user name and using it for
I am using Active Directory to authenticate users for an intranet site. I would
I have an intranet application using windows authentication that works great. Now I have
I have an ASP.Net MVC intranet site which uses Windows Authentication to know who
An IIS7 Intranet site with Windows Authentication enabled. When hit from Chrome on windows
Having an issue with random individuals trying to access an intranet site with a
I have a web application set up on our intranet that uses windows authentication
I deployed a windows application in the following website http://StagingServer/MyProgs/MPP/ on my intranet site,
We have an instance of IIS6 running an intranet website with Windows Authentication and

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.