miércoles, 3 de agosto de 2016

Microsoft OWIN troubleshooting tips for Asp.Net MVC 5- Asp.Net Core

Implementing Identity Auth in an existing Asp.Net MVC project

1.- The default ASP.Net MVC project template from Visual Studio contains the complete implementation for this, create an example project.
2.- Copy the implementation of the following classes:
App_Start folder - IdentityConfig.cs
App_Start folder - Startup.Auth.cs
Models- AccountViewModel.cs
Models- IdentityModels.cs

Root Folder: Startup.cs


3.- Verify the installation and update the references for the following Nuget packages:

Microsoft.Owin
Microsoft.Owin.Security.Cookies
Microsoft.Owin.Security.Oauth
Microsoft.Owin.Security

4.- The connection string configuration from the web.config file:

  <connectionStrings>
    <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\aspnet-ExampleMVC-20160724094734.mdf;Initial Catalog=aspnet-ExampleMVC-20160724094734;Integrated Security=True"
      providerName="System.Data.SqlClient" />
  </connectionStrings>

Modify to suit your database environment.

5.- With all the steps followed you should be able to use the Identity API in a new project the same way it works in the default template.