Tôi đang thử mở một cửa sổ mới bằng url.Action. Và url Cửa sổ mới nằm ngoài dự án hiện tại này (trang web bên ngoài).url.Chuyển liên kết mở trong cửa sổ mới trên ASP.NET MVC Page
Dưới đây là hai điều tôi cần phải làm:
- tôi cần phải mở nó trong một cửa sổ mới.
- Nó sẽ
http://localhost:57391/Home/http:/www.yahoo.com
thay vì trực tiếp đến Yahoo.
Đây là mã của tôi:
<tr >
<td>
<a href="<%= Url.Action("http://www.yahoo.com") %>"><span>Go to Yahoo</span></a>
</td>
</tr>
Hoàn toàn đúng, như một mặt lưu ý: trong trường hợp đó là một hành động điều khiển thực: " 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. –
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