使用int键时输入字符串格式错误

It'*_*rap 12 c# asp.net asp.net-mvc asp.net-identity

首先,我想向您保证,我已经在SO上阅读了许多类似标题的帖子.

我已经创建了一个ASP.NET MVC项目,并在本文后面将模板表的键更改为int

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

但是我在这行StartUp.Auth.cs中遇到了运行时错误

getUserIdCallback: (id) => (id.GetUserId<int>()))
Run Code Online (Sandbox Code Playgroud)

Error = System.FormatException:输入字符串的格式不正确.任何帮助表示赞赏.

Que*_*tin 25

我知道这是一个迟到的回应.但是对于将来可能遇到此问题的人:清除缓存或切换到其他浏览器.

虽然你改变了PK stringint代码并更新Identity相关的表,该cookie仍然您用绳子PKS登录的一个.


sad*_*bot 6

要摆脱此错误,您需要清除您网站的Cookie.

Chrome:F12 - >应用程序 - >存储 - > Cookie - >您的网站 - >清除