Question

All I have used a'lot of libraries to generate Pdf from html on Asp.net C#. It works fine on local hosting. but generate security issue when upload on shared hosting.

In ItextSharp pdf generation tool this issue is resolved by updating the assembly info file Itextsharp have not much control on CSS.

Then i tried to use https://github.com/tuespetre/Pechkin

http://www.html-to-pdf.net/

Both (Pechkin and Expert Pdf Convertor) work fine on localhost but when i upload this after publish it throws Exception on creating pdf object.

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.

[SecurityException: Request failed.]
   Pechkin.Factory.Create(GlobalConfig config) +0
   client_GenerateReport2.Button5_Click(Object sender, EventArgs e) +270
   System.EventHandler.Invoke(Object sender, EventArgs e) +0
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9752490
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +196
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6704
   System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +245
   System.Web.UI.Page.ProcessRequest() +72

You can also check the issue from url given below http://ospr3y.com.192-185-11-183.secure24.win.hostgator.com/client/GenerateReport2.aspx

But search some one says to update the webconfig trust level to Full but hostgar restrict to change this section of config. Can some one help how to resolve this hosting issue or some pdf generation component which do not cause issue on shared hosting.

Was it helpful?

Solution

this is a problem of security. Most of pdf generation libraries work on full trust level. After research i find a library www.sautinsoft.com which work on medium trust level to generate html to pdf.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top