Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/333.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Asp.net简单成员资格。更改密码失败_C#_Asp.net Mvc_Simplemembership - Fatal编程技术网

C# Asp.net简单成员资格。更改密码失败

C# Asp.net简单成员资格。更改密码失败,c#,asp.net-mvc,simplemembership,C#,Asp.net Mvc,Simplemembership,我在应用程序中使用简单的成员身份。我已经将userId的数据类型从int更改为bigint,并相应地更改了userId的所有引用字段中的数据类型。 创建用户、编辑用户功能工作正常。但当我们更改密码时,会出现以下错误 “隐式将long转换为int?不可能” 我的代码: if (ModelState.IsValid) { bool resetResponse = WebSecurity.ResetPassword(model.ReturnToken.ToString(), model.Pa

我在应用程序中使用简单的成员身份。我已经将userId的数据类型从int更改为bigint,并相应地更改了userId的所有引用字段中的数据类型。 创建用户、编辑用户功能工作正常。但当我们更改密码时,会出现以下错误

“隐式将long转换为int?不可能”

我的代码:

if (ModelState.IsValid)
{
     bool resetResponse = WebSecurity.ResetPassword(model.ReturnToken.ToString(), model.Password.ToString());
     if (resetResponse)
     {
         ViewBag.Message = "Successfully Changed";
     }
     else
     {
         ViewBag.Message = "Something went horribly wrong!";
     }
}
请告诉我是什么问题

提前感谢。

试试这个:

enable-migrations
add-migration UserIdTypeChange ' or whatever you want to name it'     
update database

包管理器控制台

可以在

工具->库包管理器->


你能展示一下你的工作吗?数据库是如何创建的?是代码优先的方法吗?是的,是代码优先。您是否尝试过启用迁移,然后更新数据库?您是如何修改SimpleMembership使用的其他表的实体的?据我所知,它们是无法更改的。密码与UserProfile存储在一个单独的表中,我猜外键仍然是一个int。您需要显示更多的工作才能得到有用的答案。