2016-06-14 91 views
1

Rotativa PDF授權問題,我需要它的動態頁眉和頁腳的每一頁。所以我用視圖來顯示頁眉和頁腳。的頭,我已經通過創建一個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身份驗證,我只能看到服務器的頁眉和頁腳,如果我能夠,我不想匿名身份驗證。 您能否爲此問題建議任何解決方法。

回答

0

你嘗試

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,      
       }; 
相關問題