<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://www.logicwiki.co.uk.logicmade.com/index.php?action=history&amp;feed=atom&amp;title=Adding_MVC_5_Identity_to_an_Existing_Project</id>
		<title>Adding MVC 5 Identity to an Existing Project - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://www.logicwiki.co.uk.logicmade.com/index.php?action=history&amp;feed=atom&amp;title=Adding_MVC_5_Identity_to_an_Existing_Project"/>
		<link rel="alternate" type="text/html" href="https://www.logicwiki.co.uk.logicmade.com/index.php?title=Adding_MVC_5_Identity_to_an_Existing_Project&amp;action=history"/>
		<updated>2026-06-19T07:56:56Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.26.2</generator>

	<entry>
		<id>https://www.logicwiki.co.uk.logicmade.com/index.php?title=Adding_MVC_5_Identity_to_an_Existing_Project&amp;diff=855&amp;oldid=prev</id>
		<title>AliIybar at 14:44, 11 May 2016</title>
		<link rel="alternate" type="text/html" href="https://www.logicwiki.co.uk.logicmade.com/index.php?title=Adding_MVC_5_Identity_to_an_Existing_Project&amp;diff=855&amp;oldid=prev"/>
				<updated>2016-05-11T14:44:00Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;' lang='en'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 14:44, 11 May 2016&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l21&quot; &gt;Line 21:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 21:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;1) Right click on App_Start folder and Add &amp;gt; Class. Name it: '''FilterConfig.cs'''&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;1) Right click on App_Start folder and Add &amp;gt; Class. Name it: '''FilterConfig.cs'''&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;place the following code in your file:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;place the following code in your file:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre class=&amp;quot;brush:&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;csharp&lt;/del&gt;;&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre class=&amp;quot;brush:&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;C#&lt;/ins&gt;;&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;using System.Web;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;using System.Web;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;using System.Web.Mvc;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;using System.Web.Mvc;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>AliIybar</name></author>	</entry>

	<entry>
		<id>https://www.logicwiki.co.uk.logicmade.com/index.php?title=Adding_MVC_5_Identity_to_an_Existing_Project&amp;diff=165&amp;oldid=prev</id>
		<title>Dt1nh6: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://www.logicwiki.co.uk.logicmade.com/index.php?title=Adding_MVC_5_Identity_to_an_Existing_Project&amp;diff=165&amp;oldid=prev"/>
				<updated>2016-05-09T13:27:23Z</updated>
		
		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;tr style='vertical-align: top;' lang='en'&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 13:27, 9 May 2016&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan='2' style='text-align: center;' lang='en'&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Dt1nh6</name></author>	</entry>

	<entry>
		<id>https://www.logicwiki.co.uk.logicmade.com/index.php?title=Adding_MVC_5_Identity_to_an_Existing_Project&amp;diff=164&amp;oldid=prev</id>
		<title>Macrop at 11:09, 22 September 2015</title>
		<link rel="alternate" type="text/html" href="https://www.logicwiki.co.uk.logicmade.com/index.php?title=Adding_MVC_5_Identity_to_an_Existing_Project&amp;diff=164&amp;oldid=prev"/>
				<updated>2015-09-22T11:09:22Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Category:MVC]]&lt;br /&gt;
[[Category:CSharp]]&lt;br /&gt;
&lt;br /&gt;
 Install-Package Microsoft.AspNet.Identity.Core &lt;br /&gt;
 Install-Package Microsoft.AspNet.Identity.EntityFramework&lt;br /&gt;
 Install-Package Microsoft.AspNet.Identity.Owin &lt;br /&gt;
 Install-Package Microsoft.Owin.Security.Facebook&lt;br /&gt;
 Install-Package Microsoft.Owin.Security.Google&lt;br /&gt;
 Install-Package Microsoft.Owin.Security.MicrosoftAccount&lt;br /&gt;
 Install-Package Microsoft.Owin.Security.Twitter&lt;br /&gt;
 Install-Package Microsoft.AspNet.WebApi.Client &lt;br /&gt;
 Install-Package Microsoft.Owin.Host.SystemWeb&lt;br /&gt;
 &lt;br /&gt;
 Install-Package Microsoft.Owin.Security.OAuth &lt;br /&gt;
 Install-Package Microsoft.Owin.Security.Cookies&lt;br /&gt;
&lt;br /&gt;
That should be all the NuGet references you need to install. Now let’s create the files that make up Visual Studio 2013’s MVC 5 Web Application’s Account Login and Registration System.&lt;br /&gt;
&lt;br /&gt;
We will start in the App_Start folder and make our way down.&lt;br /&gt;
&lt;br /&gt;
1) Right click on App_Start folder and Add &amp;gt; Class. Name it: '''FilterConfig.cs'''&lt;br /&gt;
place the following code in your file:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:csharp;&amp;quot;&amp;gt;&lt;br /&gt;
using System.Web;&lt;br /&gt;
using System.Web.Mvc;&lt;br /&gt;
 &lt;br /&gt;
namespace MVC5FullApp&lt;br /&gt;
{&lt;br /&gt;
  public class FilterConfig&lt;br /&gt;
  {&lt;br /&gt;
    public static void RegisterGlobalFilters(GlobalFilterCollection   filters)&lt;br /&gt;
    {&lt;br /&gt;
      filters.Add(new HandleErrorAttribute());&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
2) Right click on App_Start folder and Add &amp;gt; Class. Name it: '''Startup.Auth.cs'''&lt;br /&gt;
Dont forget the dot between Startup &amp;amp; Auth “Startup.Auth.cs”&lt;br /&gt;
place the following code in your file:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:csharp;&amp;quot;&amp;gt;&lt;br /&gt;
using System.Web;&lt;br /&gt;
using System.Web.Mvc;&lt;br /&gt;
 &lt;br /&gt;
using Microsoft.AspNet.Identity;&lt;br /&gt;
using Microsoft.Owin;&lt;br /&gt;
using Microsoft.Owin.Security.Cookies;&lt;br /&gt;
using Owin;&lt;br /&gt;
 &lt;br /&gt;
namespace MVC5FullApp&lt;br /&gt;
{&lt;br /&gt;
  public partial class Startup&lt;br /&gt;
  {&lt;br /&gt;
  // For more information on configuring authentication, please visit   http://go.microsoft.com/fwlink/?LinkId=301864&lt;br /&gt;
    public void ConfigureAuth(IAppBuilder app)&lt;br /&gt;
    {&lt;br /&gt;
    // Enable the application to use a cookie to store information for the signed in user&lt;br /&gt;
      app.UseCookieAuthentication(new CookieAuthenticationOptions&lt;br /&gt;
      {&lt;br /&gt;
        AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,&lt;br /&gt;
        LoginPath = new PathString(&amp;quot;/Account/Login&amp;quot;)&lt;br /&gt;
      });&lt;br /&gt;
      // Use a cookie to temporarily store information about a user logging in with a third party login provider&lt;br /&gt;
       &lt;br /&gt;
 app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);&lt;br /&gt;
 &lt;br /&gt;
// Uncomment the following lines to enable logging in with third party login providers&lt;br /&gt;
//app.UseMicrosoftAccountAuthentication(&lt;br /&gt;
// clientId: &amp;quot;&amp;quot;,&lt;br /&gt;
// clientSecret: &amp;quot;&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
//app.UseTwitterAuthentication(&lt;br /&gt;
// consumerKey: &amp;quot;&amp;quot;,&lt;br /&gt;
// consumerSecret: &amp;quot;&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
//app.UseFacebookAuthentication(&lt;br /&gt;
// appId: &amp;quot;&amp;quot;,&lt;br /&gt;
// appSecret: &amp;quot;&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
//app.UseGoogleAuthentication();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
The rest of the code for this project I am going to simply put in a .Zip file and let you install manually, because it is too much code to put on the tutorial. Simply extract the .zip file and copy the files from the Controllers folder to the controllers folder in your project, and so on.&lt;br /&gt;
&lt;br /&gt;
Identity_Tut_Files&lt;br /&gt;
&lt;br /&gt;
So I simply opened up the folder of this Zip File and drag &amp;amp; Dropped them into the solution. I did not have to include the files, Visual Studio made them available upon dropping them in.&lt;br /&gt;
&lt;br /&gt;
Ok we should have all of those files in the project now, go through each one and open them one by one and make sure there are no errors or squiggly lines. If we did our job at providing all of the right references before dropping these files in there should be no errors.&lt;br /&gt;
&lt;br /&gt;
We still need to add one more file, we can do this manually. Right Click on the root directory and add a class. Name it Startup.cs Inside that file put the following code:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:csharp;&amp;quot;&amp;gt;&lt;br /&gt;
using Microsoft.Owin;&lt;br /&gt;
using Owin;&lt;br /&gt;
&lt;br /&gt;
[assembly: OwinStartupAttribute(typeof(MVC5FullApp.Startup))]&lt;br /&gt;
namespace MVC5FullApp&lt;br /&gt;
{&lt;br /&gt;
public partial class Startup&lt;br /&gt;
{&lt;br /&gt;
public void Configuration(IAppBuilder app)&lt;br /&gt;
{&lt;br /&gt;
ConfigureAuth(app);&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
That should allow us to build and run our project.&lt;br /&gt;
&lt;br /&gt;
Now our project is working with Identity, OWIN, the account pages work, but we need a link in our navigation to them.&lt;br /&gt;
&lt;br /&gt;
Let’s go to our _LoginPartial.cshtml and remove the bootstrap code and add our foundation code so that it works in our navigation. Let’s just replace the code from @if (Request.IsAuthenticated) to the bottom of the page with:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:xml;&amp;quot;&amp;gt;&lt;br /&gt;
@if (Request.IsAuthenticated)&lt;br /&gt;
{&lt;br /&gt;
using (Html.BeginForm(&amp;quot;LogOff&amp;quot;, &amp;quot;Account&amp;quot;, FormMethod.Post, new { id = &amp;quot;logoutForm&amp;quot;, @class = &amp;quot;right&amp;quot; }))&lt;br /&gt;
{&lt;br /&gt;
@Html.AntiForgeryToken()&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;li class=&amp;quot;has-dropdown&amp;quot;&amp;gt;&lt;br /&gt;
@Html.ActionLink(&amp;quot;Hello &amp;quot; + User.Identity.GetUserName() + &amp;quot;!&amp;quot;, &amp;quot;Manage&amp;quot;, &amp;quot;Account&amp;quot;, routeValues: null, htmlAttributes: new { title = &amp;quot;Manage&amp;quot; })&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;ul class=&amp;quot;dropdown&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;javascript:document.getElementById('logoutForm').submit()&amp;quot;&amp;gt;Log off&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
else&lt;br /&gt;
{&lt;br /&gt;
&amp;lt;li class=&amp;quot;has-dropdown&amp;quot;&amp;gt;&lt;br /&gt;
@Html.ActionLink(&amp;quot;Log in&amp;quot;, &amp;quot;Login&amp;quot;, &amp;quot;Account&amp;quot;, routeValues: null, htmlAttributes: new { id = &amp;quot;loginLink&amp;quot; })&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;ul class=&amp;quot;dropdown&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;@Html.ActionLink(&amp;quot;Register&amp;quot;, &amp;quot;Register&amp;quot;, &amp;quot;Account&amp;quot;, routeValues: null, htmlAttributes: new { id = &amp;quot;registerLink&amp;quot; })&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;@Html.ActionLink(&amp;quot;Log in&amp;quot;, &amp;quot;Login&amp;quot;, &amp;quot;Account&amp;quot;, routeValues: null, htmlAttributes: new { id = &amp;quot;loginLink&amp;quot; })&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now let’s uncomment the line we have in our navigation that loads the LoginPartial. It’s in the _Foundation.cshtml file. Just uncomment it and we are good to go. Build and run your site. YOu should have a login button on your navigation that once logged in will have a dropdown with options. Were done, you will need to format those login and registration pages, but the hard work is done!&lt;/div&gt;</summary>
		<author><name>Macrop</name></author>	</entry>

	</feed>