File access error from dotnet assembly

ottobe
Member Posts: 67
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.
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.
0
Comments
-
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, /wisaAustrian NAV/BC Dev0 -
Did you find a solution to your problem, Ottobe?0
-
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?0
-
Looks like it is being solved by unlocking the DLL in the Add-In folder.0
-
- sure that you done Attachments.CALCFIELDS("Embedded File");
- sure that temporary file really exists and have nonzero length.0 -
Remco_Reinking wrote: »Looks like it is being solved by unlocking the DLL in the Add-In folder.
How i can unlock DLL?0 -
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions