Code access security policy doubts.
vineeth_karinta_at_yahoo.com
Date: 10/23/03
- Previous message: Michel Gallant: "Re: Verify signature unsing X509Certificate"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Thu, 23 Oct 2003 11:06:13 -0700
I am preparing for MCAD 70-316 and i have the following
doubt about code access security policy.
I have a windows form application - MyApp.exe assembly
were I need to set the code group policy.
I wanted the application not to access the file dialog.
So I did the following.
1. Select Start, Programs, Administrative Tools, Microsoft
.NET Framework Configuration.
2. Expand the Runtime Security Policy node, then the User
node, and then the Permission Sets node.
3. Right-click the Everything permission set and select
Duplicate. A new permission set named Copy of
Everything is created.
4. Right-click the Copy of Everything permission set and
select Rename. Rename the permission set No FileDialog.
5. With the No FileDialog permission set selected, click
the Change Permissions link in the right panel of the
configuration tool. In the Create Permission Set dialog
box, select File Dialog and click Remove.
6. Expand the Code Groups node and click the default All
Code code group. Click the Add a Child Code Group link
in the right panel of the configuration tool.
7. In the Create Code Group dialog box, name the new
group MyAppPolicy.
8. Choose the Hash condition. Click the Import button and
browse to MyApp.exe. Click Open to calculate the hash
for this file. Click Next.
9. Select the No FileDialog permission set and click Next.
Click Finish to create the new code group.
10. Right-click the MyAppPolicy code group and select
Properties. Check the box to make this code group
exclusive.
In the code set the following.
[assembly:FileDialogPermissionAttribute
(SecurityAction.RequestMinimum, Unrestricted=true)]
As I excepted when I run this form application I got the
security
Exception thrown by the CLR.
Then I change the assembly to the following code
[assembly:FileDialogPermissionAttribute
(SecurityAction.RequestMinimum, Unrestricted=false)]
Then my application can start with out any security
exception thrown by the CLR. I wanted to know what
difference it makes when I change the second parameter of
the FileDialogPermissionAttribute constructor to
"Unrestricted=false" in my scenario.
Hope some body can help me to solve this issue.
Thanks & Regards
Vineeth Karinta
- Previous message: Michel Gallant: "Re: Verify signature unsing X509Certificate"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]