Re: Code Access Security

From: Philip Rieck (junk_at_mckraken.com)
Date: 10/08/04


Date: Thu, 7 Oct 2004 20:48:22 -0500

I notice that you stated that you assigned the "Everything" permission set.
Note that this is *not* the same as "Full Trust". So you will not be able
to call into anything that does not allow partially trusted callers. See if
switching to "Full Trust" fixes your issue. If so, the problem is probably
a call you're making that does not allow partial trust. (Much of the "core"
FCL does not allow partialy trusted callers, so a plain .net app "out of the
box" could see this issue)

-- 
-Philip Rieck
http://philiprieck.com/blog/
-
"Richard Blewett [DevelopMentor]" <richardb@develop.com> wrote in message 
news:enq$44KrEHA.3676@TK2MSFTNGP10.phx.gbl...
> The error message you are seeing looks like a Winforms default one - can 
> you trap the exception nearer teh site that it happens (maybe where you 
> show the other form (if you call ShowDialog on it) so we can have a look 
> at the exception trace and see what is generating the SecurityException
>
> Regards
>
> Richard Blewett - DevelopMentor
> http://staff.develop.com/richardb/weblog
>
> 
> nntp://news.microsoft.com/microsoft.public.dotnet.framework/<2A513F57-F7AF-46C6-809A-61473EB15832@microsoft.com>
>
> I see what you're saying Richard.
> No COM objects... that's the weird thing about this whole mess. The 
> failing
> part of this app is just another form trying to load a grid with SQL data.
> All built in .NET, part of the same project.
>
> "Richard Blewett [DevelopMentor]" wrote:
>
> > Hmm ... but you don't actually do any interop?
> >
> > Imports just saves you some typing it doesn't actually create a 
> > reference to any assemblies. The interop layer is contained in mscorlib 
> > which you will already be referencing. You don't need InteropServices to 
> > do strong naming - you need the reflection namespace for the 
> > AssemblyKeyFile attribute though.
> >
> > If you actually do any interop (use COM objects, have Declare 
> > statements, etc) then this would be the cause of your exception as the 
> > interop layer will issue a demand for a SecurityPermission for unmanaed 
> > code access. Partially trusted code doesn't get this permission by 
> > default and so you would get a SecurityException.
> >
> > Regards
> >
> > Richard Blewett - DevelopMentor
> > http://staff.develop.com/richardb/weblog
> >
> > nntp://news.microsoft.com/microsoft.public.dotnet.framework/>
> >
> > I did type it in :)
> > I do have a reference (Imports) to System.Runtime.InteropServices in
> > AssemlyInfo.vb
> > I only added that reference as I saw it in the help files from Microsoft
> > regarding creating Strong Names for assemblies.
> >
> >
> >
> > "Richard Blewett [DevelopMentor]" wrote:
> >
> > > I'm assuming you typed that in rather than cut and paste it - -so do 
> > > you mean it required the SecurityPermission?
> > >
> > > Does your code use interop?
> > >
> > > Regards
> > >
> > > Richard Blewett - DevelopMentor
> > > http://staff.develop.com/richardb/weblog
> > >
> >
> >
>
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.771 / Virus Database: 518 - Release Date: 28/09/2004
>
>
>
> [microsoft.public.dotnet.framework] 


Relevant Pages

  • Re: Problems with AzMan interop and CLR 2
    ... well - also in 1.x AzMan needs fulltrust - COM interop always requires full trust. ... subsequently the 2.0 GAC now grants full trust to any assembly that is ...
    (microsoft.public.dotnet.security)
  • Re: AzMan Still the way to go?
    ... A couple of downsides about AzMan. ... site will required full trust. ... propagated very poorly from the interop layer or wherever. ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Web Part and COM Interop
    ... "Eric Johnson" wrote in message ... > the Interop assembly. ... Nor did using the .NET Framework Wizard to fully ... Any .NET managed assembly needs full trust to use COM interop. ...
    (microsoft.public.sharepoint.windowsservices)