Granting FileIOPermission to a referenced assembly RRS feed

  • Question

  • I am trying to compile the source version of DotNetNuke. As many of you might be knowing, the main DNN website project references a number of other projects. One of them is named FileBasedCachingProvider.

    The source project compiles successfully, but throws the IOPermission exception, when trying to execute code of this project. The complete exception detail is as follows:

    System.Security.SecurityException was unhandled by user code
      Message="Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."
           at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
           at System.Security.CodeAccessPermission.Demand()
           at System.IO.Path.GetFullPath(String path)
           at DotNetNuke.Services.Cache.FileBasedCachingProvider.FBCachingProvider.GetFileName(String FileName) in R:\Data\Source\Library\Providers\CachingProviders\FileBasedCachingProvider\FileBasedCachingProvider.vb:line 280
           at DotNetNuke.Services.Cache.FileBasedCachingProvider.FBCachingProvider.Insert(String CacheKey, Object objObject, Boolean PersistAppRestart) in R:\Data\Source\Library\Providers\CachingProviders\FileBasedCachingProvider\FileBasedCachingProvider.vb:line 116
           at DotNetNuke.Framework.Reflection.CreateType(String TypeName, String CacheKey, Boolean UseCache, Boolean IgnoreErrors)

    What should I do in order to get the project to run successfully???
    Tuesday, May 27, 2008 5:13 PM

All replies

  • Hi Rahul,


    Have you tried to give ASP.NET web application user account necessary privileges for File IO operations?


    It seems, DNN component tries to read from disk (System.IO.Path.GetFullPath(String path)). It is possible that providing read permissions to user account could be sufficient.


    Wednesday, May 28, 2008 11:34 AM
  • Yes, the ASP.NET user account already has Full Control over the root directory of the site...
    Thursday, May 29, 2008 4:38 AM
  •  Rahul Singla wrote:
    Yes, the ASP.NET user account already has Full Control over the root directory of the site...


    Try to call System.IO.Path.GetFullPath(String path) manually from your ASP.NET application. It could be possible, that DNN components try to work with other folders, than root directory.

    Thursday, May 29, 2008 6:29 AM
  • I believe I need to grant FileIO permission explicitly to that project's compiled assembly being referenced.
    How can I do it (grant explicit FileIO permission to a project's assembly)???
    Thursday, May 29, 2008 3:21 PM