Home All Groups Group Topic Archive Search About

IOPermission while saving configuration file

Author
4 Sep 2006 1:20 PM
ditnooitlezen
In a windows form app (2.0) I get an IOPermission failed while
executing the lines:

  Configuration exeConfig =
ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
  // ... add one item
   exeConfig.Save(ConfigurationSaveMode.Modified);

The exeConfig resides on a network share. When I configure
'unresctricted access' on the network share it works, however
'RW,append+path disc. permissions configured on that share or even on
the exact file, does not work.

How does it work?

Author
5 Sep 2006 4:58 PM
Nicole Calinoiu
Could you please post the full exception details (including call stack
listing), as returned by its ToString method?


<ditnooitle***@gmail.com> wrote in message
Show quoteHide quote
news:1157376046.592167.301580@i3g2000cwc.googlegroups.com...
> In a windows form app (2.0) I get an IOPermission failed while
> executing the lines:
>
>  Configuration exeConfig =
> ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
>  // ... add one item
>   exeConfig.Save(ConfigurationSaveMode.Modified);
>
> The exeConfig resides on a network share. When I configure
> 'unresctricted access' on the network share it works, however
> 'RW,append+path disc. permissions configured on that share or even on
> the exact file, does not work.
>
> How does it work?
>
Author
6 Sep 2006 12:35 PM
hermans.gerard
Thanks for your support, here follow the exception details:
--
A first chance exception of type 'System.Security.SecurityException'
occurred in mscorlib.dll
System.Security.SecurityException: Request for the permission of type
'System.Security.Permissions.FileIOPermission, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
failed.
   at System.Security.CodeAccessSecurityEngine.Check(Object demand,
StackCrawlMark& stackMark, Boolean isPermSet)
   at System.Security.CodeAccessPermission.Demand()
   at System.Security.AccessControl.FileSecurity..ctor(String fileName,
AccessControlSections includeSections)
   at
System.Configuration.Internal.WriteFileContext.DuplicateTemplateAttributes(String
source, String destination)
   at
System.Configuration.Internal.WriteFileContext.DuplicateFileAttributes(String
source, String destination)
   at System.Configuration.Internal.WriteFileContext.Complete(String
filename, Boolean success)
   at
System.Configuration.Internal.InternalConfigHost.StaticWriteCompleted(String
streamName, Boolean success, Object writeContext, Boolean
assertPermissions)
   at
System.Configuration.Internal.InternalConfigHost.System.Configuration.Internal.IInternalConfigHost.WriteCompleted(String
streamName, Boolean success, Object writeContext, Boolean
assertPermissions)
   at
System.Configuration.Internal.InternalConfigHost.System.Configuration.Internal.IInternalConfigHost.WriteCompleted(String
streamName, Boolean success, Object writeContext)
   at
System.Configuration.Internal.DelegatingConfigHost.WriteCompleted(String
streamName, Boolean success, Object writeContext)
   at System.Configuration.UpdateConfigHost.WriteCompleted(String
streamName, Boolean success, Object writeContext)
   at System.Configuration.MgmtConfigurationRecord.SaveAs(String
filename, ConfigurationSaveMode saveMode, Boolean forceUpdateAll)
   at System.Configuration.Configuration.SaveAsImpl(String filename,
ConfigurationSaveMode saveMode, Boolean forceSaveAll)
   at System.Configuration.Configuration.Save(ConfigurationSaveMode
saveMode)
   at WaaiWinClient.WClient1..ctor()
The action that failed was:
Demand
The type of the first permission that failed was:
System.Security.Permissions.FileIOPermission
The Zone of the assembly that failed was:
Intranet
--
I was surprised to discover the last two lines 'Intranet Zone', because
I configured a special code group with the URL membership condition
\\myserver\myshare\*. If more than one union code group matches, the
combination of their permission sets is granted.

So what should I do to let it discover my special code group?

Thanks.

Nicole Calinoiu schreef:

Show quoteHide quote
> Could you please post the full exception details (including call stack
> listing), as returned by its ToString method?
>
>
> <ditnooitle***@gmail.com> wrote in message
> news:1157376046.592167.301580@i3g2000cwc.googlegroups.com...
> > In a windows form app (2.0) I get an IOPermission failed while
> > executing the lines:
> >
> >  Configuration exeConfig =
> > ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
> >  // ... add one item
> >   exeConfig.Save(ConfigurationSaveMode.Modified);
> >
> > The exeConfig resides on a network share. When I configure
> > 'unresctricted access' on the network share it works, however
> > 'RW,append+path disc. permissions configured on that share or even on
> > the exact file, does not work.
> >
> > How does it work?
> >