如何在ASP.NET MVC中获取绝对URL?

r.r*_*r.r 0 c# url asp.net-mvc href

在我看来,我给出的URL是这样的:

<td style="border-bottom: solid 1px #f3ad44" align="center">
    <a class="actions" href="<%= item.URL  %>">www...</a>
</td>
Run Code Online (Sandbox Code Playgroud)

我的问题是item.URL有一个类似的值:www.hello.com但当我从网页点击它导航到http://localhost:64075/www.hello.com.

如何避免使用localhost,并实际导航到http://www.hello.com

Fre*_*örk 6

确保在URL http://内部item.URL或标记中使用正确的协议(例如)作为前缀:[...] href="http://<%= item.URL %>">[...].