title: How to get custom Id from AspNetUsers table
body: <p>I'm currently working on a website which is being developed in ASP.NET and C#. To get the<code>UserId</code> from <code>AspNetUsers</code> table by simply doing <code>User.Identity.GetUserId()</code> which returns something like <code>m13t79j0-4p5e-829h-4x10-fyv74k0w2ff6</code>. Now I need to change this to a custom <code>UserId</code> which will be an <code>int</code> so something like </p>
  
  <pre><code>1
  2
  3
  and so on
  </code></pre>
  
  <p>In the <code>IdentityModel</code> I have the following code to point to the table custom table and Id</p>
  
  <pre><code>protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder)
      {
          base.OnModelCreating(modelBuilder);
  
          modelBuilder.Entity&lt;ApplicationUser&gt;().ToTable("CustomTable").Property(p =&gt; p.Id).HasColumnName("MyCustomId");
      }
  </code></pre>
  
  <p>However when I do <code>User.Identity.GetUserId()</code> it still returns this id <code>User.Identity.GetUserId()</code>. I'm fairly new to C# and ASP.NET so can someone tell me where I'm going wrong? Do I have to override the <code>GetUserId()</code> method? Thanks in advance for all your help and support </p>