与Html.ActionLink绝对(外部)的URL [英] Absolute (external) URLs with Html.ActionLink
本文介绍了与Html.ActionLink绝对(外部)的URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我无法得到Html.ActionLink产生绝对URL。
I'm unable to get Html.ActionLink to produce absolute urls.
Html.ActionLink(DataBinder.Eval(c.DataItem, "Name").ToString(), DataBinder.Eval(c.DataItem, "Path").ToString())
这是直接从我的模型正确的数据,但追加路径添加到当前页的末尾,产生类似的URL的http://本地主机:24590 / www.google.com
This pulls the data from my model correctly, but appends the path to the end of the current page, producing URLs like "http://localhost:24590/www.google.com"
我怎样才能得到这个工作,我怎么想?
How can I get this to work how I want it to?
推荐答案
使用绝对URL开头即的http://
Use an absolute URL starting with i.e. http://
.
<a href="www.google.com"></a>
将有同样的结果,因为它是一个相对URL。
would have the same result, because it's a relative url.
这篇关于与Html.ActionLink绝对(外部)的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文