Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html Asp.net Mvc重定向Url_Html_Asp.net Mvc - Fatal编程技术网

Html Asp.net Mvc重定向Url

Html Asp.net Mvc重定向Url,html,asp.net-mvc,Html,Asp.net Mvc,在我的asp.net mvc项目中,我希望操作重定向到url,但我希望页面在新窗口中打开 public ActionResult Index(int id) { ... return Redirect(page.Url); } 您应该指定链接将使用视图中元素的target属性在新窗口中打开,即 <a href="@Url.Action("Index", "Controller", new{ area = "

在我的asp.net mvc项目中,我希望操作重定向到url,但我希望页面在新窗口中打开

public ActionResult Index(int id)
        {
            ...

            return Redirect(page.Url);
        }

您应该指定链接将使用视图中元素的target属性在新窗口中打开,即

<a href="@Url.Action("Index", "Controller", new{ area = "", id = 1 })" 
   target= "_blank">Link text</a>

您应该指定链接将使用视图中元素的target属性在新窗口中打开,即

<a href="@Url.Action("Index", "Controller", new{ area = "", id = 1 })" 
   target= "_blank">Link text</a>

要在客户端打开一个新窗口,您必须在查看HTML或使用一些javascript中执行某些操作。这不能在控制器中完成


在视图中,您可以从调用此操作的位置设置操作链接的目标属性。

要在客户端打开新窗口,您必须在视图HTML中或使用一些javascript。这不能在控制器中完成


在视图中,您可以从调用此操作的位置设置操作链接的目标属性。

在服务器端,您可以在ajax调用后重新运行json

    public ActionResult PreviewReport(Report rep)
    {
        return Json(new { type = "info", url = "..." }, JsonRequestBehavior.AllowGet);
    }
在客户端执行javascript,结果来自对上述操作的ajax调用

 function (result) {
        if (result.type === 'info') {
            window.open(result.url, '_blank');
        } 
    }

在服务器端,您可以在ajax调用后重新运行json

    public ActionResult PreviewReport(Report rep)
    {
        return Json(new { type = "info", url = "..." }, JsonRequestBehavior.AllowGet);
    }
在客户端执行javascript,结果来自对上述操作的ajax调用

 function (result) {
        if (result.type === 'info') {
            window.open(result.url, '_blank');
        } 
    }

非常感谢。但在实际操作中,我做了一些控制,并决定打开空白目标或普通。据我所知,您不能从服务器端设置为在新窗口中打开。谢谢。但在实际操作中,我做了一些控制,并决定打开空白目标或普通。据我所知,您不能从服务器端设置为在新窗口中打开。