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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:14:27+00:00 2026-05-28T15:14:27+00:00

<authentication mode=Windows/> <authorization> <allow users=USERS/> <allow roles=ROLES/> <deny users=*/> </authorization> Is there a way

  • 0
<authentication mode="Windows"/>
        <authorization>
            <allow users="USERS"/>
            <allow roles="ROLES"/>
            <deny users="*"/>
        </authorization>

Is there a way to write an if statement in here to detect what url I am on so I can allow a certain role for that certain URL.

Example code in my head of what I kind of want to see:

If (UCase(Url) = UCase("URL")) Then
<allow roles="ROLES"/>
ElseIF(UCase(Url) = UCase("URL")) Then
<allow roles="ROLES"/>
ElseIF (UCase(Url) = UCase("URL")) Then
<allow roles="ROLES"/>
End If
<deny users="*"/>

Is this even allowed in the web.config? If it isn’t how could I go about doing this?

I have 3 websites. One for Dev, UAT and PROD. Now for each sites I have different user groups for each set up. I just want to find a way that I can just find what URL i’m at and point it at the certain user group. I’m guessing I have to make a web.config for each because you can’t do conditional statements but I’m just making sure. If I have to make a web.config for each how can I go about setting that up?

  • 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-28T15:14:28+00:00Added an answer on May 28, 2026 at 3:14 pm

    Edit (changed the whole answer as I think your issue is now different)

    Your best option is to have different configuration settings in each web.config which is what web.config files are for. You might have to look at your deployment process if you deploy the web.config each time (either manually or automatically).

    Another option would be to instead have your application do the authorisation by knowing what environment it is running in and denying access using code. That path is obviously more work than something that has already been provided, but is an option.

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

Sidebar

Related Questions

Web.config file <authentication mode=Windows /> <authorization> <allow users =* /> </authorization> IIS permissions (Unchecked)Enable
So, I have the following in the web.config <authentication mode=Windows/> <authorization> <allow users=domain\johndoe />
In the web.config: <configuration> <authentication mode=Windows> </authentication> <authorization> <deny users=? /> </authorization> </configuration> in
There is a web service application hosted On IIS 7.5. Authentication mode is Windows.
Say I have the following web.config: <?xml version=1.0 encoding=utf-8?> <configuration> <system.web> <authentication mode=Windows></authentication> </system.web>
I have configured my web application to run under windows authentication mode, I also
I have a sql server 2008R2 express running in windows authentication mode. I created
Using SQL Server 2005 I attached the database in Windows authentication Mode, then it
Details of my app: - ASP.NET MVC 3 - Windows Authentication mode - IIS
Does anyone know how to determine the security mode (Mixed Mode or Windows Authentication)

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.