Tuesday, 28 June 2011

Runtime error Request for the permission of type 'System.Security.Permissions.FileIOPermission

problem

c# security fucken error!!! (microsoft SUCKS)
---------------------------
Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
difficulty level

3/10 :|
compatibility

vs2008 .net 2.5
solution

- be sure that the file you are trying to open it from you code, is in the same directory or somewhere where is valid to reach- open the properties of the application
- go to at security tab
- click "Enable ClickOnce security settings"
- select "This is a partial trust"
- Zone your application: (custom)
- Select above all the secutiry settings required from the environment where the application will run (consider about this!). You must include FileIOPermission if your application open files. Do not include regardless permissions because in case where the end user hasn't them (i.e. guest user) your application will not run.
- Under all these, there is a button "Advanced" where it is not displayed sometimes if your monitor has lo resolution, scroll down to see it, press it and there you may find the settings if you with to use this "permission set" on debug execution. If you selected to use this settings you cannot use the specified arguments at "debug" tab of the parameters (one more reason why Microsoft sucks). Your application will use the command line arguments finally in "release" version.
- SAVE the parameters window and then ReBuild!
- open the file c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\web.config ; this key and update accordingly: <trust level="Full" originUrl=""/>

No comments:

Post a Comment