Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

persmissions question

4 views
Skip to first unread message

Eric

unread,
Dec 29, 2009, 9:09:02 AM12/29/09
to
Hi,

I wrote my website as dynamicly as possible due to the vast amoun of changes.
So certain images are drawn by the application and then stored in a temp
folder to which a page refers to.
These drawings are saved as PNG.

Now I have added a functionality where a report is generated based on given
data and this report is also saved in the temp folder. The report is a PDF
document.

When writing this PDF document into the temp folder I get this error message:

Request for the permission of type
'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Why is my application allowed to write several other file type (PNG, txt) to
this folder but not PDF?

Strangely enough when the user opens a PDF document stored in the database
it is written to the same folder without any problems.

I use a dll from pdf4net to generate my report file.

how can I solve this?

rg,
Eric

Gregory A. Beamer

unread,
Dec 29, 2009, 10:52:26 AM12/29/09
to
=?Utf-8?B?RXJpYw==?= <Er...@discussions.microsoft.com> wrote in
news:B5ED6025-376B-4F2B...@microsoft.com:

> Why is my application allowed to write several other file type (PNG,
> txt) to this folder but not PDF?

There are two possible reasons:

1. It is actually the call to use PDF4NET that is raising the security
issue.

2. PDF4NET, in particular, is considered unsafe in saving operations.

Try saving to a folder in the website proper. If it passes then, you have
your culprit.

Peace and Grace,

--
Gregory A. Beamer (MVP)

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************

o2sol.com

unread,
Dec 30, 2009, 12:39:59 PM12/30/09
to
Hi Eric,

Please let me know the PDF4NET version you currently use. Also, please post
here, or send me, the full stack trace of the exception you receive. To
identify more precise the source of the exception you can try the following:
instead of calling the PDFDocument.SaveToFile method (or the PDFDocument.Save
method with the file name as parameter) you can open a FileStream object with
write access and call the PDFDocument.Save method that accepts a Stream as
parameter. If the problem appears when the FileStream is created then it is a
security access problem to your file. If the problem still appears when
calling the PDFDocument.Save(filestream) method, it might be a problem in
PDF4NET and I recommend to send us an email.

Kind regards,
Adrian Marin
Technical Support Engineer
O2 Solutions - precisely fit software
www.o2sol.com
techsupport [ AT ] o2sol [ DOT ] com

0 new messages