Open URL in a new tab from MVC controller

Yoda picture Yoda · Mar 26, 2015 · Viewed 31.7k times · Source

How do i open an URL in a new tab / window from MVC controller based on success condition .Any way i can achieve it through the help of c# code without having to write javascript ?

Answer

Hussein Zawawi picture Hussein Zawawi · Mar 26, 2015

This cannot be done from the controller , but rather from your razor View:

@Html.ActionLink("linkText", "Action", new {controller="ControllerName"}, new {target="_blank"})