Web.config allows all users from a specific domain, but not

I have users from two different domains who can access the website that I am currently working on, and I would like to allow users of only one of these domains to access the site. I did some research, and the only thing I could come up with was to allow users from a specific domain group, but not only from the entire domain.

I also came across this message suggesting to check the domain manually at login:

http://bytes.com/topic/asp-net/answers/343407-using-web-config-allow-access-domain-users-only

I added this to web.config, but it does not seem to work:

<authorization> <deny users="?"/> <allow users="FirstDomain\Domain Users"/> <deny users="SecondDomain\Domain Users" /> </authorization> 

Thanks,

+4
source share
3 answers

In the end it works:

 <authorization> <allow roles="FirstDomain\Domain Users"/> <deny users="*"/> </authorization> 
+5
source

"Allow" must precede the "Deny" tags, as in your case everyone will be denied access.

 <system.web> <authorization> <allow users="FirstDomain\Domain Users"/> <deny users="SecondDomain\Domain Users" /> </authorization> </system.web> 

Hope this helps.

+4
source

Since you are using IIS, you can check the passage of Microsoft to allow or deny access to your site.

-1
source

Source: https://habr.com/ru/post/1438689/


All Articles