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

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.


To get rid of this error you need to clear cookies for your site.

Chrome: F12 -> Application -> Storage -> Cookies -> your site -> Clear