[quoted text, click to view] "David++" <David@discussions.microsoft.com> wrote in message
news:4CBBF8F9-22FB-483D-AFD4-B5063E05B2DE@microsoft.com...
> Hello again,
>
> Ok, I've been trying to solve this for the last couple of days now and
> still
> no joy. The error that is getting thrown is -
>
> Request for the permission of type
> 'System.Security.Permissions.EnvironmentPermission, mscorlib,
> Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
>
> And if I click details it also says -
>
> The Zone of the assembly that failed was:
> Intranet
>
> In the Project properties I have ran the 'Calculate Permissions' and it
> says
> that to run the application must be 'Full Trust'. So I have tried
> deploying
> as full trust and no joy.
Exactly what happened when you attempted to deploy as a fully trusted
ClickOnce app? Were you running from the ClickOnce harness page or were you
trying to run the executable directly off a network share? If the former,
were you prompted to elevate the assembly's permissions?
[quoted text, click to view] > I have also built the application using Partial
> Trust and excluded the EnvironmentPermission. Still no joy this way.
If the assembly is missing EnvirnmentPermssion, you need to include it, not
exclude it, when creating a partial trust ClickOnce manifest.
[quoted text, click to view] > I have Signed the application with a Strong name and produced a strong
> name
> key file. If I then build and place the exe of the application on the
> Network, and also configure the Microsoft .NET 2.0 Framework Configuration
> by
> adding a new group to the All_Code then this works. Is this correct?
It's one valid way of acquiring a full trust grant.
[quoted text, click to view] > I'm new
> to strong names and Microsoft .NET configuration. If I do this, is it
> granting the securities to just my application?
It will grant the elevated permissions to all assemblies signed with your
strong name key unless you also add name and version evidence to the strong
name membership condition for the code group.
[quoted text, click to view] > If so then this should be
> acceptable.
>
> Another option would be to simply 'turn off' the thing throwing the
> security
> exception. However its still not clear for me how to do this..its not
> really
> straight forward. I'm on VS 2005 if that helps.
You can't disable the code access security system from within partially
trusted code. Even if you could, you shouldn't since this will leave the
client machines vulnerable to attacks from other assemblies that ought to be
partially trusted.
[quoted text, click to view] > Is there anything programmatically i can set in my application which means
> I
> dont have to Configure anything externally?
No. If you were able to do this, so could a malicious developer. The
closest you can come at present is deploying as a ClickOnce assembly, where
at least you won't need to modify CAS policy on each client machine.