【发布时间】:2013-03-21 14:26:47
【问题描述】:
我有以下代码行:
return Json(new { redirectTo = UrlHelper.Action("Index", "Home") });
和
ModelState.AddModelError("Useraccount.Email", emailAlreadyExistsException.Message);
对于 UrlHelper.Action 方法和 ModelState.AddModelError 方法,我想避免硬编码字符串。还有更好的可能吗?
【问题讨论】:
-
我希望我可以为 UrlHelper.Action 使用类似 RedirectToRouteResult 的东西。
标签: asp.net-mvc asp.net-mvc-3 modelstate urlhelper