Sunday, January 9, 2011

Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561

Hi,

We had a requirement to generate a PDF report in a table with all items for the selected vendor with their respective images. Thanks to ItextSharp for the wonderful utility to generate PDF's. Since we embed image in run time, while executing the part,
table.AddCell(image.Getinstance() we get the following exception:

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

Googled for the message and found that the solution is that we need to set trust level as full in web.config. Since it is an internal application for us it is not a big deal in our case. Any ways planning to encrypt the PDFs as password protected.

Solution: trust level="Full" in web.config
Resource: http://forums.asp.net/p/1422162/3433380.aspx

Hope It Helps :)

Regards
Fauzi