title: Difference in AspNetCore identity 2.0 and 2.1
body: <ul>
  <li>What is the difference in AddIdentity and AddDefaultIdentity </li>
  </ul>
  
  <p><strong>ConfigureServices Method in Startup from AspNetCore identity 2.0</strong></p>
  
  <pre><code> public void ConfigureServices(IServiceCollection services)
      {
          services.AddDbContext&lt;ApplicationDbContext&gt;(options =&gt;
              options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
  
          services.AddIdentity&lt;ApplicationUser, IdentityRole&gt;()
              .AddEntityFrameworkStores&lt;ApplicationDbContext&gt;()
              .AddDefaultTokenProviders();
  
          // Add application services.
          services.AddTransient&lt;IEmailSender, EmailSender&gt;();
  
          services.AddMvc();
      }
  </code></pre>
  
  <p><strong>ConfigureServices Method in Startup from AspNetCore identity 2.1</strong></p>
  
  <pre><code> public void ConfigureServices(IServiceCollection services)
      {
          services.Configure&lt;CookiePolicyOptions&gt;(options =&gt;
          {
              // This lambda determines whether user consent for non-essential cookies is needed for a given request.
              options.CheckConsentNeeded = context =&gt; true;
              options.MinimumSameSitePolicy = SameSiteMode.None;
          });
  
          services.AddDbContext&lt;ApplicationDbContext&gt;(options =&gt;
              options.UseSqlServer(
                  Configuration.GetConnectionString("DefaultConnection")));
          services.AddDefaultIdentity&lt;IdentityUser&gt;()
              .AddEntityFrameworkStores&lt;ApplicationDbContext&gt;();
  
          services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
      }
  </code></pre>