私のウェブサイトには、ページの内容をPDFとして印刷できる機能があります。私はこれに対していくつかのオプションを試しましたが、多言語の文字を扱うので、wkhtmltopdfがベストマッチでした。wkhtmltopdf.exeクラウドWebサーバーのSystem.Security.SecurityException。サーバーのセキュリティポリシーを無効にするにはどうすればいいですか
私はそれは私のローカルサーバーに取り組んでしまったが、私は今、それは私に次のエラー
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
Exception Details: System.Security.SecurityException: Request failed.
を与えているホスティングのためのクラウドWebサーバにアップロードするとき、私は、web.configファイル内にセキュリティポリシーを変更し
<securityPolicy>
<trustLevel name="Full" policyFile="internal"/>
</securityPolicy>
しかし、それはまだ
テストURLを動作していない http://www.noor.com.asp1-20.dfw1-2.websitetestlink.com/ArticleDetails.aspx?Language=en-US&PageID=19&ArticleID=4
ですこのダウンロードリンクの裏にあるダウンロードリンクをクリックすると、Webページの特定のセクションをPDFに変換できます。ローカルサーバー上で正常に動作しますが、Webサーバー上のセキュリティ上の理由で動作しません。私はPDFを稼働させるために何日も探していましたが、現在はWebサーバー上で動作していません。私は他のオプションを試してみましたが、何らかの理由でiTextがアラビア語を変換していなかったのは、アラビア語のページのみのジャンク文字を印刷していたためです。
私はそれを正しくするために何を変えるべきかアドバイスしてください。
C#の
コードを使用してasp.net 4.0を使用して、このウェブサイトを、私を開発してきた私は、PDF
CODE WORKINGstring url = "PrintArticle.aspx?articleID=" + Request["articleID"] + "&download=yes&Language=" + Request["Language"];
// string args = string.Format("\"{0}\" - ", url);
string args = string.Format("\"{0}\" - ", "http://www.domain.com.asp1-20.dfw1-2.websitetestlink.com/" + url);
var startInfo = new ProcessStartInfo(Server.MapPath("bin\\wkhtmltopdf.exe"), args)
{
UseShellExecute = false,
CreateNoWindow = true,
RedirectStandardOutput = true
};
var proc = new Process { StartInfo = startInfo };
proc.Start();
string output = proc.StandardOutput.ReadToEnd();
byte[] buffer = proc.StandardOutput.CurrentEncoding.GetBytes(output);
proc.WaitForExit();
proc.Close();
Response.ContentType = "application/pdf";
Response.AddHeader("Content-Disposition", "attachment;filename=download.pdf");
Response.BinaryWrite(buffer);
Response.End();