简体   繁体   English

从MVC重定向aspx

[英]Redirect aspx from MVC

I have created some menu on MVC. 我已经在MVC上创建了一些菜单。 I want to redirect to aspx when user click on these menu. 当用户单击这些菜单时,我想重定向到aspx。 Here's the menu: 这是菜单:

<nav>
    <ul id="menu">
        <li>@Html.ActionLink("Home", "Index", "Home")</li>
        <li>@Html.ActionLink("About", "About", "Home")</li>
        <li>@Html.ActionLink("Contact", "Contact", "Home")</li>
        <li>@Html.ActionLink("Request", "Request", "Home")</li>
        <li>@Html.ActionLink("Articles", "Articles", "Home")</li>
        <li>@Html.ActionLink("Services", "Services", "Home")</li>
    </ul>
</nav>

Where Home, About and Contact is in MVC ie chtml but for Request, Articles and Services I have respective aspx page. 在MVC中,如Home,About和Contact,即chtml,但对于Request,Articles和Services,我有各自的aspx页面。 Can some one tell me how can I redirect to aspx? 有人可以告诉我如何重定向到aspx吗?

One might argue the MVC way would be to create a controller which then does a redirect to the .aspx resource. 有人可能会说MVC方式将是创建一个控制器,然后将其重定向到.aspx资源。 However, you can use UrlHelper.Content with a relative path to get a URI for the resource. 但是,可以将UrlHelper.Content与相对路径结合使用来获取资源的URI。 For example: 例如:

<a href="@Url.Content(~/Admin/request.aspx)">Request</a>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM