Nick-ACNB
Nick-ACNB

Reputation: 665

Possible to add iis express configuration (windows authentication) to asp.net mvc6 project?

Is it possible to setup an asp.net mvc6 application to run with windows authentication when debugging using IISExpress without having to edit the global iis express configuration file?

In visual studio 2013, you had the possibility to go to properties on your web application project and edit it from there. The changes resulted in some extra xml in the .csproj file with the information.

However, the .kproj file from asp.net mvc6 projects does not have the configuration listed.

I have tried to add the xml properties from vs2013 to the .kproj file which has had no effect.

Is this not yet implemented?

Upvotes: 2

Views: 1294

Answers (2)

Matt Lengenfelder
Matt Lengenfelder

Reputation: 739

Right-click on ASP.net 5 / MVC 6 project and select properties. On the left click on Debug. At the bottom of the Properties->Debug page uncheck enable anonymous authentication check Enable Windows Authentication

In your controllers you'd put something like [Authorize(Roles = "Domain\\Group")] above the class or action methods

Upvotes: 1

Malgaur
Malgaur

Reputation: 1850

Yes, simply add your web.config file to your wwwroot directory with the IIS configurations that you want.

web.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
        <security>
            <authentication>
                <windowsAuthentication enabled="true" />
                <anonymousAuthentication enabled="false" />
            </authentication>
        </security>
  </system.webServer>
</configuration>

Upvotes: 1

Related Questions