File access error from dotnet assembly

ottobeottobe Member Posts: 67
edited 2015-09-29 in NAV Three Tier
Hi
I am using PDFsharp library to merge some PDF's.
Preliminary with server and client on my Win7 development machine.
But when trying to read or write to files a get this error on the PdfReader.Open statement, indicating PDFsharp is not allowed to do file access.
Any suggestion on how to set permissions will be appreciated.

InputFileName := FileManager.ServerTempFileName('pdf');
TempBLOB.Blob := Attachments."Embedded File";
FileManager.BLOBExportToServerFile(TempBLOB, InputFileName);
InputDocument:= PdfReader.Open(InputFileName, PdfDocumentOpenMode.Import);

FOR Count := 0 TO InputDocument.Pages.Count - 1 DO
BEGIN
Page := InputDocument.Pages.Item(Count);
OutputDocument.AddPage(Page);
END;

Error:
System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Comments

  • Wisa123Wisa123 Member Posts: 308
    Hello,

    Keep in mind that with RunOnClient = false the Service user performs the action, and therefore has to be permitted to do so.
    Also make sure to not mess up local and server paths.

    Regards, /wisa
    Austrian NAV/BC Dev
  • sundfarsundfar Member Posts: 28
    Did you find a solution to your problem, Ottobe?
  • Remco_ReinkingRemco_Reinking Member Posts: 74
    Having the same problem, when calling a function in a webservice that is using dotnet to access files on the server. Anybody a clue how to solve this? Is there a function or property telling the system that it is okay for the add-in to access the local file system?
  • Remco_ReinkingRemco_Reinking Member Posts: 74
    Looks like it is being solved by unlocking the DLL in the Add-In folder.
  • lubostlubost Member Posts: 628
    - sure that you done Attachments.CALCFIELDS("Embedded File");
    - sure that temporary file really exists and have nonzero length.
  • DolshaDolsha Member Posts: 41
    Looks like it is being solved by unlocking the DLL in the Add-In folder.

    How i can unlock DLL?
Sign In or Register to comment.