从 ASP.NET MVC 中的控制器在新选项卡中打开 link

Open a link in new tab from controller in ASP.NET MVC

我想在浏览器中显示超链接,当我点击超链接时,请求转到我的控制器并在浏览器的新选项卡中打开 URL。

知道如何实现吗?

@*This is index.cshtml*@
@{
    ViewBag.Title = "Index";
}

<h2>Click on the link below</h2>
@Html.ActionLink("GOOGLE", "NewWindow", "Home")
    public class HomeController : Controller
    {
        // GET: Home
        public ActionResult Index()
        {
            return View();
        }
        public ActionResult NewWindow()
        {
            return Content("<script>window.open('https://www.google.com/','_blank')</script>");
        }
    }
}

此代码显示错误。请帮助

使用target="_blank"在新的window中打开一个link。

@Html.ActionLink("GOOGLE", "RedirectToGoogle", "Home", null, new { target = "_blank" })

在控制器中,return 重定向到所需的 URL:

public ActionResult RedirectToGoogle()
{
    return Redirect("https://www.google.com/");
}