I've created Internet MVC Application with Individual User Accounts
Authentication, but now this project should be intranet with windows authentication... How to switch authentication, when project is almost done? I'm not guru in MVC and this is new technology for me, so any help please and if possible with all steps in description=)
Select File >> New >> select ASP.NET Core Web Application, and change the authentication to Windows Authentication. We can also configure the existing application for Windows Authentication by selecting the option of WA. To configure the authentication manually, open Visual Studio project properties >> go to Debug tab.
From the ASP.NET project window select "WebAPI". Click on the "Change Authentication" button. From the Change Authentication dialog select "Individual User Accounts". Click on the "OK" button.
By default MVC apps use Form Authentication and Simple Membership, so you need to make it "false" to run Windows Authentication. Select the project name in Solution Explorer and then in the Property Explorer, click to enable Windows Authentication.
In the Web.config of you project. The first step would be change:
<authentication mode="Forms">
</authentication>
to
<authentication mode="Windows">
</authentication>
Selecting your project and hitting F4 for the properties window allows you to change the authentication method.
However instead of me putting step by step in here just use this very easy to follow tutorial: Enabling Windows Authentication
Since I found this question through google attempting the same thing, and Firearm's link doesn't quite do the process justice, I'll attempt to list the steps I went through here. Obviously, if I tell you to remove something, that only means if you aren't using it otherwise. I don't think you have to do these steps in any particular order. Also, I'm using Entity Framework, so you'll have to look elsewhere to remove it.
<authentication mode="None" />
with <authentication mode="Windows" />
<authorization>
<deny users="?" />
</authorization>
. Under system.webServer, remove handlers
. under modules, remove <remove name="FormsAuthentication" />
.ManageViewModels
from your models.IdentityConfig
and Startup.Auth
.throwIfV1Schema: false
in your constructors. Then you can get rid of IdentityModels
from your Models folder. Add a new migration and update your database.Possible additional step: * remove _LoginPartial view. The _Layout view will then be updated to replace partial display of that view with this line:
<p class="nav navbar-text navbar-right">Hello, @User.Identity.Name!</p>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With