Gre*_*gle 7 asp.net asp.net-mvc webforms
我正在添加一个WebForm,我想从中解析到URL的路由.例如,在MVC中我会使用
return RedirectToAction("Action", "Controller");
Run Code Online (Sandbox Code Playgroud)
因此,如果您有一种方法可以从同一个应用程序中的WebForm获取相同的URL,那么我们将不胜感激.
eu-*_*-ne 15
在Webform中尝试这样的事情:
<% var requestContext = new System.Web.Routing.RequestContext(
new HttpContextWrapper(HttpContext.Current),
new System.Web.Routing.RouteData());
var urlHelper = new System.Web.Mvc.UrlHelper(requestContext); %>
<%= urlHelper.RouteUrl(new { controller = "Controller", action = "Action" }) %>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3748 次 |
| 最近记录: |