Sunday, February 19, 2012

Custom Assembly Problems: System.Drawing

Hi,
I built a Custom Assembly to allow me to use external image files in
my report. I deployed the DLL and configured the security policy
config files.
Everything worked great, i got the image coming through to my report
in both Designer Preview mode and when deployed.
I decided to extend the custom assembly to return the dimensions of
the image as well by adding some code that utilizes System.Drawing.DLL
//ok now, lets get the width and height
//FileIOPermission permission = new FileIOPermission
Image myImage = Image.FromFile(pPath);
g_lastHeight = myImage.Height;
g_lastWidth = myImage.Width;
myImage.Dispose();
myImage=null;
After rebuilding and deploying the DLL, my report no longer has any
images when deployed.
However, the images do show up in Designer preview mode, and the DLL
performs correctly returning the image dimensions upon request,
implying a security policy issue'
So my question is what security policy type things do i need to do in
order to utilize System.Drawing.dll in my DLL.
Any help would be greatly appreciated.
Thanks
DerekI believe the correct permission is UIPermission. Please see the following for why it only works in
preview and how to configure the server:
http://msdn.microsoft.com/library/?url=/library/en-us/dnsql2k/html/dngrfCodeAccessSecurityInSQLServer2000ReportingServices.asp?frame=true
Thanks.
Donovan R. Smith
Software Test Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
"Derek W" <derek@.brokerbuilders.com> wrote in message
news:a5df538d.0408161409.6d219516@.posting.google.com...
> Hi,
> I built a Custom Assembly to allow me to use external image files in
> my report. I deployed the DLL and configured the security policy
> config files.
> Everything worked great, i got the image coming through to my report
> in both Designer Preview mode and when deployed.
> I decided to extend the custom assembly to return the dimensions of
> the image as well by adding some code that utilizes System.Drawing.DLL
> //ok now, lets get the width and height
> //FileIOPermission permission = new FileIOPermission
> Image myImage = Image.FromFile(pPath);
> g_lastHeight = myImage.Height;
> g_lastWidth = myImage.Width;
> myImage.Dispose();
> myImage=null;
> After rebuilding and deploying the DLL, my report no longer has any
> images when deployed.
> However, the images do show up in Designer preview mode, and the DLL
> performs correctly returning the image dimensions upon request,
> implying a security policy issue'
> So my question is what security policy type things do i need to do in
> order to utilize System.Drawing.dll in my DLL.
> Any help would be greatly appreciated.
> Thanks
> Derek

No comments:

Post a Comment