How to install ASP Security Kit package in your ASP.NET Mvc project and troubleshoot installation issue
Steps to install
Note: In Visual Studio 2013, ASP.NET MVC 4 Web Application template is located under Web\Visual Studio 2012. You can upgrade to ASP.NET MVC 5 using NuGet after ASP Security Kit is installed in the project.
Set-ExecutionPolicy Bypass -Scope Process
Note: By executing the above command we are instructing PowerShell (the execution engine for Package Manager Console) to run scripts that will install ASP Security Kit without complaining about signing ETC. We’ll reset this instruction as soon as ASP Security Kit is installed in step 7.
Once installation is complete, you will see a message box stating whether or not package installed successfully.
What if I got an error?
Here are possible issues along with their resolution:
NuGet reported that project installed successfully but neithre I saw ASP Security Kit 'Sign in' prompt nore I could see any new files/binaries in my project.
- Make sure you installed ASP Security Kit using Package Manager Console in Visual Studio and not by any other mean (including 'Manage NuGet Packages...' dialog or NuGet.exe command line). You can reinstall if you did not.
- If you did install via console, make sure you followed this step before installing. You can reinstall if you did not.
How to reinstall?
ASP Security Kit Powershell installer can be executed multiple times in a project and it will override any files with the same name in the project. This way you can fix failed/partial installations. To run installation again, do the following:
- Open the packages.config file found in your project folder.
- Delete the xml node (tag name 'package') that specifies ASPSecurityKit as part of its id attribute.
- Save (and optionally close) packages.config
- Begin installation by following these steps
I got failed installation message from ASP Security Kit installer; what can I do?
No problem! ASP Security Kit installer logs diagnostic information in the file <packages>\ASPSecurityKit.<version>\logs.txt. Please mail this file to us at [email protected] and we'll help you troubleshoot the issue.
Sometimes, when you are installing ASP Security Kit in a project bound to a source control such as TFS, installation may halt without completion. You can attempt reinstall at least once and see if it finishes with a success message.
Create the Database
As stated here, ASP Security Kit comes preloaded with EF migrations and T-Sql scripts to get the database ready as soon as you install ASP Security Kit.
While you are in the Package Manager Console, run the following command (hint: you can copy and paste it).
You will see messages something like ‘Applying code-based migrations: ….’. If all goes well, the last message you see is ‘Running Seed method.’
ASP Security Kit has added some useful configuration settings that it uses for the application. You can have a look at them in the appSettings section in the root web.config. By default most are populated with default value or values you provided on ‘Select Package Options’ form during installation.
Following settings aren’t populated by default and are required for forgot/reset password flow to work:
The above settings are used by Mailer.cs class installed in your project under Infrastructure\Utils. Email and password settings are self-explanatory; the provider setting can take one of three values: Gmail, Outlook or Yahoo. The Mailer class is preconfigured to work with these popular mail providers; since you have the source with you, you can extend it to work with any additional provider you plan to use for your project.
Congrats, We are done!
Press F5/ctrl+F5 to run the application. Congrats for installing ASP Security Kit! You are going to absolutely love the secure, flexible and rapid development basis it provides. Features that earlier used to take days to complete can now be completed within hours and in some case, within minutes!