开发者

Writing External URLS from Database with Razor

A very easy que开发者_如何学Cstion. I am just getting started with MVC. I have external URL's stored in my database. The following line of markup renders the link www.google.com as localhost/Home/www.google.com

<a href="@item.URL" target="_blank">@Html.DisplayFor(modelItem => item.Title)</a>

Where am I going wrong

Cheers


It doesn't actually render that way but since you have no protocol http:// or http:// in front of it.. it thinks it is a path based on your current page. So - append a protocol in front of it

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜