4

I have a web application protected by windows authentication. In Asp.NET 4.5 I can use the web.config file to specify exactly which users can use it

<configuration>
    <system.web>
        <authorization>
            <allow users="TEST\admin" />
            <deny users="*" />
        </authorization>
    </system.web>
</configuration>

In Asp.NET core the web.config file is gone, I guess the allow and deny rules should be moved to launchSettings.json file, but I can't find any reference on how to do it. So... How can I do it? This is the current authentication setting

"iisSettings": {
    "windowsAuthentication": true,
    "anonymousAuthentication": false,
}
Naigel
  • 9,086
  • 16
  • 65
  • 106
  • You can use Thinktecture IdentityServer and link it to your AD for instance – rmjoia Sep 28 '17 at 09:16
  • Did you work out how to do this in the end? Unfortunately, the answer as of Jul 2020 doesn't actually tell us how to add specific users, nor does the link provided. I would love to know if and how you solved it. – kkuilla Jul 29 '20 at 11:11

1 Answers1

0

Actually launchSettings.json file is only used by VS. When you publish your app (or run without VS) launchSettings.json is not being used. When you run with IIS/IISExpress you just need to make sure that your web.config has correct settings.

See this Asp.Net core MVC application Windows Authentication in IIS

Soumen Mukherjee
  • 2,953
  • 3
  • 22
  • 34