-2

I would like to share how to successfully import ASP.NET Identity into ASP.NET MVC Boilerplate using Visual Studio 2013.

O. Coder
  • 21
  • 6

1 Answers1

0

I found lots of questions, but no definitive answers.

So here's what I came up with:

Decide on a project\solution name

    The two projects\solutions must use the same names

    Create them in seperate directories

        Projects\Web\<SolutionDir>
        Projects\MVC\<SolutionDir>

Create project from template - ASP.NET Web Application

    Select a template - MVC

    Rebuild Solution

    Close Solution


Create project from template - ASP.NET MVC Boilerplate

    Right-click Project

        Properties

            Make sure Assembly name and Default namespace is the same

    Rebuild Solution

        There may be some missing namespaces

        Double-click the build errors to open effected code

        ReSharper can help automatically regenerate the missing namespaces

    Right-click References

        Manage Nuget Packages

            Install packages:

                Microsoft.Owin.Host.SystemWeb
                Microsoft.AspNet.Identity.Core
                Microsoft.AspNet.Identity.OWIN
                Microsoft.AspNet.Identity.EntityFramework
                Microsoft.Owin.Security.Google

    Copy the following files and folder structure from ASP.NET Web project into ASP.NET MVC project:

        files:

        App_Start\IdentityConfig
        App_Start\Startup.Auth
        Controllers\AccountController.cs
        Controllers\ManageController.cs
        Models\AccountController
        Models\IdentityModels
        Models\AccountViewModels
        Startup.cs

        folders:

        Views\Account
        Views\Manage

    Insert the following into Configuration method of Start.cs:

            ConfigureAuth(app);

    Find following section in Web.config from ASP.NET Web project and copy into Web.config in ASP.NET MVC project:

        <connectionStrings>
            <add
                name="DefaultConnection"
                connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\..."
                providerName="System.Data.SqlClient" />
        </connectionStrings>

    Rebuild Solution

References:

O. Coder
  • 21
  • 6