[英]long to int conversion exception with ASP.NET MVC4 WebSecurity.ConfirmAccount(string token)
這似乎讓我感到困惑。 我正在使用MVC4 Simple成員身份只是為了幫助實現我的帳戶流程自動化。 除了我調用WebSecurity.ConfirmAccount(string令牌)和WebSecurity.ResetPassword(string令牌,string newPassword)方法時,其他一切看起來都不錯。 當使用為用戶生成的正確令牌傳遞時,方法拋出和long to in轉換異常均會出錯,但執行時不會出錯,並且使用錯誤的令牌傳遞時,返回false。 我有什么錯誤嗎?
您不能將long
類型轉換為int
類型,因為long
從內存中保留64位,而int
從內存中保留32位。 因此,嘗試將long
轉換為int
將導致異常。
聽起來您的UserId
列是作為bigint
而不是int
創建的。 WebMatrix.WebData.SimpleMembershipProvider
希望該WebMatrix.WebData.SimpleMembershipProvider
int
:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.