Search code examples
c#asp.netasp.net-mvcasp.net-identity

Input string was not in a correct format error on using int keys


First i want to assure you that i have already read many posts with similar title on SO.

I have created an ASP.NET MVC project and changed the keys of template tables to int following this article

http://www.asp.net/identity/overview/extensibility/change-primary-key-for-users-in-aspnet-identity

But i am getting a runtime error in this line of StartUp.Auth.cs

getUserIdCallback: (id) => (id.GetUserId<int>()))

Error = System.FormatException: Input string was not in a correct format. Any help is appreciated.


Solution

  • I know it's a late response. But for people who may encounter this in the future: Clear your cache or switch to a different browser.

    Although you changed the pk from string to int in the code and updated Identity related tables, the cookie was still the one you logged in with string pks.