Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/14.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
Asp.net mvc 页眉和页脚的Rotativa PDF授权问题_Asp.net Mvc_Wkhtmltopdf_Rotativa - Fatal编程技术网

Asp.net mvc 页眉和页脚的Rotativa PDF授权问题

Asp.net mvc 页眉和页脚的Rotativa PDF授权问题,asp.net-mvc,wkhtmltopdf,rotativa,Asp.net Mvc,Wkhtmltopdf,Rotativa,我已经通过Rotativa创建了一个PDF,我需要在它的每个页面动态页眉和页脚。所以我使用视图来显示页眉和页脚 代码如下:- string customswitch = string.Format("--allow {0} --footer-html {0} --allow {1} --header-html {1}", Url.Action("Footer", "Home", new { area = "" }, "http"), Url.Action(

我已经通过Rotativa创建了一个PDF,我需要在它的每个页面动态页眉和页脚。所以我使用视图来显示页眉和页脚

代码如下:-

string customswitch = string.Format("--allow {0} --footer-html {0} --allow {1} --header-html {1}",
                    Url.Action("Footer", "Home", new { area = "" }, "http"), Url.Action("Header", "Home", new { area = "" }, "http"));
    [AllowAnonymous]
    public ActionResult Footer()
    {

        return View();
    }


    [AllowAnonymous]
    public ActionResult Header()
    {

        return View();
    }
它在本地运行良好,但在部署之后。我看不到页眉和页脚。我在IIS上使用windows身份验证,如果启用匿名身份验证,我只能在服务器上看到页眉和页脚,我不想这样做。 您能否建议解决此问题的方法。

您尝试过吗

foreach (var key in Request.Cookies.AllKeys)
            {

                CookieCollection.Add(key, Request.Cookies.Get(key).Value);
            }

return new ViewAsPdf(viewName, model)
                {
                    FileName = fileName,
                    CustomSwitches = customSwitches,
                    Cookies = CookieCollection,                    
                };
你试过了吗

foreach (var key in Request.Cookies.AllKeys)
            {

                CookieCollection.Add(key, Request.Cookies.Get(key).Value);
            }

return new ViewAsPdf(viewName, model)
                {
                    FileName = fileName,
                    CustomSwitches = customSwitches,
                    Cookies = CookieCollection,                    
                };