更新时间:2021-08-17 22:13:01
您需要将UpdateUser
操作的返回类型从Task<ActionResult>
更改为Task<RedirectToRouteResult>
You need to change the return type of UpdateUser
action from Task<ActionResult>
to Task<RedirectToRouteResult>
public Task<RedirectToRouteResult> UpdateUser(ProfileModel model)
{
return Task.Factory.StartNew(showMethod).ContinueWith(
t => {
return RedirectToAction("ViewUser","UserProfile");
});
}
或者您可以使用ActionResult
显式设置ContinueWith
方法的泛型类型参数,如下所示:
Or you could explicitly set the generic type argument of ContinueWith
method with ActionResult
, like this:
public Task<ActionResult> UpdateUser(ProfileModel model)
{
return Task.Factory.StartNew(showMethod).ContinueWith<ActionResult>(
t => {
return RedirectToAction("ViewUser","UserProfile");
});
}