Obs*_*vus 2 asp.net-mvc actionlink razor asp.net-mvc-4
这是我的 html.ActionLink:
@Html.ActionLink("Comment", "Comment", new { id = item.NewsId, title = item.Title + "#disqus_thread" })
Run Code Online (Sandbox Code Playgroud)
它给了我以下网址:
http://localhost:62394/Home/Comment/5008/Iran%20women%20barred%20from%20presidency%23disqus_thread
Run Code Online (Sandbox Code Playgroud)
而不是 "#"它生成"%23"
我怎样才能确保它变成这样:
`
http://localhost:62394/Home/Comment/5008/Iran%20women%20barred%20from%20presidency#disqus_thread
Run Code Online (Sandbox Code Playgroud)
任何形式的帮助都非常感谢!
你应该像这样使用Url.Action:
<a href="@Url.Action("Comment", new { id = item.NewsId, title = item.Title })#disqus_thread">Comment</a>
Run Code Online (Sandbox Code Playgroud)
我相信它更简单、更清洁、更安全。
| 归档时间: |
|
| 查看次数: |
3632 次 |
| 最近记录: |