gpt4 book ai didi

asp.net-mvc - 使用 html.ActionLink 时如何在我的网址中添加 "#"

转载 作者:行者123 更新时间:2023-12-02 15:36:33 25 4
gpt4 key购买 nike

这是我的 html.ActionLink:

 @Html.ActionLink("Comment", "Comment", new { id = item.NewsId, title = item.Title + "#disqus_thread" })

它给了我以下网址:

http://localhost:62394/Home/Comment/5008/Iran%20women%20barred%20from%20presidency%23disqus_thread

它生成 "%23" 而不是 "#"

我怎样才能确保它变成这样:

`

http://localhost:62394/Home/Comment/5008/Iran%20women%20barred%20from%20presidency#disqus_thread

非常感谢任何形式的帮助!

最佳答案

你应该使用 Url.Action像这样:

<a href="@Url.Action("Comment", new { id = item.NewsId, title = item.Title })#disqus_thread">Comment</a>

我相信它更简单、更清洁并且更安全

关于asp.net-mvc - 使用 html.ActionLink 时如何在我的网址中添加 "#",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16597892/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com