如何使用以前目录的URL创建操作链接?(How to make an action link with a URL for a previous directory?)

编程入门 行业动态 更新时间:2024-10-10 21:29:34
如何使用以前目录的URL创建操作链接?(How to make an action link with a URL for a previous directory?)

所以我有这个动作链接

@Html.ActionLink("Logout","LogoutConfirmation","Login")

这把我带到了一个网址: mysite.com/myaccount/Login/LogoutConfirmation 但是文件夹不在“myaccount”中,这就是我在这个网页上的当前位置。 如何将操作链接带我: mysite.com/Login/LogoutConfirmation 而不是文件夹“myaccount”。

So I have this action link

@Html.ActionLink("Logout","LogoutConfirmation","Login")

which takes me to a url like: mysite.com/myaccount/Login/LogoutConfirmation however the folder isnt located in "myaccount" its just that is my current location on this webpage. How can I make the action link to take me to: mysite.com/Login/LogoutConfirmation instead of the folder "myaccount".

最满意答案

正如我的评论中所述,只需使用重载方法来包含空Area 。

@Html.ActionLink("Logout","logoutConfirmation", "Login", new {Area=""},null)

As stated in my comment, just use the overloaded method to include an empty Area.

@Html.ActionLink("Logout","logoutConfirmation", "Login", new {Area=""},null)

更多推荐

本文发布于:2023-04-29 01:37:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1334421.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何使用   操作   链接   目录   URL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!