Two Pilots™    Home  |  Navigation  |  Site Map  |  Products  |  Download  |  Prices  |  For Partners  |  Support


All forums · Statistics · Search ·

Two Pilots forum / For software developers / Save PDFon web server-operation not allowed
Author Message
Ayaz
# Posted: 21 Oct 2007 13:55


Hi all

Problem Summary

I've created "PDF" directory to store all PDF create, and give write permission on that folder including subfolders and file

Using code below


PDFCreatorPilot3Lib.PDFDocument3Class PDF = new PDFCreatorPilot3Lib.PDFDocument3Class();


// initialize PDF Engine
PDF.StartEngine("demo@demo", "demo");

// set filename

//PDF.FileName = "PDF" + FirstName + ".PDF";
PDF.FileName = Server.MapPath("/PDF/" + FirstName + ".PDF");
PDF.AutoLaunch = true; // auto-open generated pdf document

// start document generation

PDF.BeginDoc();

// draw "HELLO, PDF" message on the current PDF page

// Header
PDF.PDFPAGE_SetActiveFont("Verdana", true, false, false, false, 14, 0);
PDF.PDFPAGE_TextOut(10, 20, 0, "Access Direct Learning");

// Content of PDF
PDF.PDFPAGE_SetActiveFont("Calibri", true, false, false, false, 12, 0);
PDF.PDFPAGE_TextOut(10, 40, 0, "First Name :" + FirstName);

// finalize document generation

PDF.EndDoc();

Error

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: System.Security.Permissions.SecurityPermission

Source Error:

Line 191:
Line 192: PDF.EndDoc();
Line 193: }
Line 194:}

Any suggestion or advice please

Thanks

Stanislav
Member
# Posted: 22 Oct 2007 01:15


Dear Ayaz,

It seems like you give permissions not for application user. Please try to give permissions to everyone. If it helps, adjust permissions to match only required user (application process owner).

Best regards,
Stanislav
Two Pilots
www.colorpilot.com

Anonymous
# Posted: 22 Oct 2007 16:03


Thanks for your reply

I've given permission to IUSR but still have got same error and please let me know if there's any thing i am missing in C# code

Thanks

here's stack track which might help
Stack Trace:

[SecurityException: System.Security.Permissions.SecurityPermission]
Test2.generate_PDF() in e:kundenhomepages30d205089371Test2.aspx.cs:193
Test2.btn_SubmitOnlineForm_Click(Object sender, EventArgs e) in e:kundenhomepages30d205089371Test2.aspx.cs:146
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEven t(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6953
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +154
System.Web.UI.Page.ProcessRequest() +86
System.Web.UI.Page.ProcessRequestWithNoAssert(Http Context context) +18
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.test2_aspx.ProcessRequest(HttpContext context) in App_Web_dkwgpfur.0.cs:0
System.Web.CallHandlerExecutionStep.System.Web.Htt pApplication.IExecutionStep.Execute() +154
System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean& completedSynchronously) +64

Stanislav
Member
# Posted: 23 Oct 2007 00:04


Dear Ayaz,

Please read more information about ASP.NET machine account here:
http://discuss.fogcreek.com/dotnetquestions/defaul t.asp?cmd=show&ixPost=2275
and here
http://www.mvps.org/marksxp/WindowsXP/aspdot.php

I don't think IUSR is what you need.

Best regards,
Stanislav
Two Pilots
www.colorpilot.com

 

 

Powered by miniBB 2.0 RC7 © 2001-2004 Page creation time (sec.): 0.013

 

Page top