C# 与Sammy.js相关的返回视图问题
我正在使用sammy.js构建一个SPA,关于sammy的路由如下所示C# 与Sammy.js相关的返回视图问题,c#,asp.net,model-view-controller,C#,Asp.net,Model View Controller,我正在使用sammy.js构建一个SPA,关于sammy的路由如下所示 this.get(/#\/user\/profile/i, function (context) { titleContent.html("User Profile"); document.title = "User Profile"; getPage("#/user/profile", "/User/Profile",
this.get(/#\/user\/profile/i, function (context) {
titleContent.html("User Profile");
document.title = "User Profile";
getPage("#/user/profile", "/User/Profile", context);
});
我有一个GET和POST视图,可以用信息更新用户帐户
[Authorize, HttpGet, Route("User/Profile")]
new public ActionResult Profile()
{
//do some stuff
return View(vm);
}
[HttpPost, Authorize, Route("User/Profile")]
new public ActionResult Profile(UserProfileViewModel vm)
{
if (!ModelState.IsValid)
return View(vm);
//other code if valid modelstate
return View(vm);
}
现在,那么!Modelstate.IsValid,它将视图返回为“/User/Profile”,而不是“/#/User/Profile”
如何使用已更新为错误消息的ViewModel返回实际的Sammy注册路由(“/#/User/Profile”)