G
Guest
I have a simple windows application that I wish to be able to run on
machines that don't trust it. The application is simply a sort of calculator
that needs to be able to export and import results to files of the user's
choosing. The application should also be able to save user preferences like
control sizing.
None of that is relevant because the application throws a security
exception before it even gets to any of the file saving code. I have the
following lines at the bottom of my AssemblyInfo.cs file:
[assembly:FileDialogPermissionAttribute(SecurityAction.RequestMinimum,
Unrestricted=true)]
[assembly:FileIOPermissionAttribute(SecurityAction.RequestOptional,
Unrestricted=true)
[assembly:IsolatedStorageFilePermissionAttribute(SecurityAction.RequestOptional, Unrestricted=true)]
I get a the following exception message when I run it in debug in visual
studio:
An unhandled exception of type 'System.Security.SecurityException' occurred
in mscorlib.dll
Additional information: Request for the permission of type
System.Security.Permissions.UIPermission ...
Commenting out either the second or the third line still leads to the
exception, however, if I comment out BOTH the second and the third line
everything is OK. What I really don't understand is why do I get a
UIPermission exception when those lines have nothing to do with
UIPermissions. Can anyone tell me why I am getting this error and how to fix
the problem.
I believe this should be reproducible on any windows forms .NET 2003
application. Simply paste the three "[assembly:..." lines above into the
bottom of your AssemblyInfo.cs file.
Thanks,
machines that don't trust it. The application is simply a sort of calculator
that needs to be able to export and import results to files of the user's
choosing. The application should also be able to save user preferences like
control sizing.
None of that is relevant because the application throws a security
exception before it even gets to any of the file saving code. I have the
following lines at the bottom of my AssemblyInfo.cs file:
[assembly:FileDialogPermissionAttribute(SecurityAction.RequestMinimum,
Unrestricted=true)]
[assembly:FileIOPermissionAttribute(SecurityAction.RequestOptional,
Unrestricted=true)
[assembly:IsolatedStorageFilePermissionAttribute(SecurityAction.RequestOptional, Unrestricted=true)]
I get a the following exception message when I run it in debug in visual
studio:
An unhandled exception of type 'System.Security.SecurityException' occurred
in mscorlib.dll
Additional information: Request for the permission of type
System.Security.Permissions.UIPermission ...
Commenting out either the second or the third line still leads to the
exception, however, if I comment out BOTH the second and the third line
everything is OK. What I really don't understand is why do I get a
UIPermission exception when those lines have nothing to do with
UIPermissions. Can anyone tell me why I am getting this error and how to fix
the problem.
I believe this should be reproducible on any windows forms .NET 2003
application. Simply paste the three "[assembly:..." lines above into the
bottom of your AssemblyInfo.cs file.
Thanks,