我想使用url.Action打開一個新窗口。 而新的Window url已經不在這個當前的項目中(外部網站)。url.Action在ASP.NET MVC的新窗口中打開鏈接頁面
這裏有兩件事情我需要做的:
- 我需要在新窗口中打開它。
- 這是去
http://localhost:57391/Home/http:/www.yahoo.com
而不是直接向雅虎。
這裏是我的代碼:
<tr >
<td>
<a href="<%= Url.Action("http://www.yahoo.com") %>"><span>Go to Yahoo</span></a>
</td>
</tr>
完全正確,作爲一個側面說明:在情況下,它是一個真正的控制器動作:" target="_blank"> could have been used of course! The Url.Action only fills in the href part, the rest of the anchor is still free to decorate with whatever attributes you'd like. – 2012-02-26 22:29:33
Or '@Html.ActionLink("New report", "New", "Report", null, new {target = "_blank"})' Source: http://stackoverflow.com/questions/7790355/asp-net-mvc-3-controller-action-and-open-new-window – Coops 2013-05-09 10:09:44