我正在尝试创建一个类似于的扩展方法MVCContrib 的 RedirectToAction 方法 http://mvccontrib.codeplex.com/SourceControl/changeset/view/c0a43d6843a7#src%2fMVCContrib%2fControllerExtensions.cs通过创建一个方法,该方法将采用 #anchor 参数并将其添加到 Url 中。我熟悉这个问题 https://stackoverflow.com/questions/602788/asp-net-mvc-redirecttoaction-with-anchor但它不是强类型的。也可以将值添加到查询字符串,但这对于锚点不起作用。
public static RedirectToRouteResult RedirectToAction<T>(this Controller controller, Expression<Action<T>> action, string anchor) where T : Controller
{
var result = new RedirectToRouteResult<T>(action);
// how can I add the #anchor to the result's url?
return result;
}
None
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)