Re: Graphics.GetHdc causes InvalidOperationException
From: Nicole Calinoiu (calinoiu)
Date: 06/29/05
- Previous message: hareesh: "access is denied in sharepoint document library event handler word"
- In reply to: Richard Morris: "Re: Graphics.GetHdc causes InvalidOperationException"
- Next in thread: Richard Morris: "Re: Graphics.GetHdc causes InvalidOperationException"
- Reply: Richard Morris: "Re: Graphics.GetHdc causes InvalidOperationException"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Wed, 29 Jun 2005 13:45:27 -0400
"Richard Morris" <khiron@community.nospam> wrote in message
news:esWHh18eFHA.688@TK2MSFTNGP14.phx.gbl...
> Hi Nicole,
>
> Thanks for answering. The problem is that assigning Full Trust to
> assemblies with MS strongkey is not enough. Is it possible that some
> assemblies which come from MS aren't signed with their key?
The strong names of Microsoft assemblies are irrelevent here. The problem
is that your control assembly does not have SecurityPermission\UnmanagedCode
on the client machine.
> protected override void OnPaint(PaintEventArgs e) {
> // serurity exception
> IntPtr hdc = e.Graphics.GetHdc();
> e.Graphics.ReleaseHdc(hdc);
Since you're not actually using the GDI device context, I'm wondering why
you're bothering with this. If it's just an incomplete sample, and you
actually need to use unmanaged GDI functions, then you'll need to set up the
client to grant SecurityPermission\UnmanagedCode to your assembly (which it
will also need for the actual GDI calls). Otherwise, you should be able to
get the method to work by dropping the above two lines.
> Would you like to take a closer look at this scenario? I could send you a
> sample project and screenshots showing the problem.
Not necessary. I was able to repro based on your sample code.
- Previous message: hareesh: "access is denied in sharepoint document library event handler word"
- In reply to: Richard Morris: "Re: Graphics.GetHdc causes InvalidOperationException"
- Next in thread: Richard Morris: "Re: Graphics.GetHdc causes InvalidOperationException"
- Reply: Richard Morris: "Re: Graphics.GetHdc causes InvalidOperationException"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|
|