FileIO Permissions error?

Feb 2, 2010 at 1:39 PM

Hi Guys,

I am using Ionic to extract simple zip files which have been renamed as MUP and suddenly started having the issue below. Can someone tell me the reason for the error?

 

The file permissions etc are all ok.

 

 

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
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.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at System.IO.File.OpenRead(String path)
   at Ionic.Zip.ZipFile.get_ReadStream()
   at Ionic.Zip.ZipFile.ReadIntoInstance(ZipFile zf)
   at Ionic.Zip.ZipFile.Read(String zipFileName, TextWriter statusMessageWriter, Encoding encoding, EventHandler`1 readProgress)
The action that failed was:
Demand
The type of the first permission that failed was:
System.Security.Permissions.FileIOPermission
The first permission that failed was:


The demand was for:


The granted set of the failing assembly was:











The assembly or AppDomain that failed was:
Ionic.Zip, Version=1.7.2.21, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c
The method that caused the failure was:
System.IO.Stream get_ReadStream()
The Zone of the assembly that failed was:
Internet
The Url of the assembly that failed was:
file:///R:/Test/Ionic.Zip.DLL


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3603 (GDR.050727-3600)
    CodeBase: file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
Automate
    Assembly Version: 1.0.0.0
    Win32 Version: 0.2.4.5
    CodeBase: file:///R:/Automate.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3082 (QFE.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
Iupdate3dll
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.1.1
    CodeBase: file:///R:/Test/Mydll.DLL
----------------------------------------
System.Web
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3082 (QFE.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Web/2.0.0.0__b03f5f7f11d50a3a/System.Web.dll
----------------------------------------
Ionic.Zip
    Assembly Version: 1.7.2.21
    Win32 Version: 1.7.2.21
    CodeBase: file:///R:/Test/Ionic.Zip.DLL
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:


    


When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

Feb 2, 2010 at 4:07 PM

Hi Guys,

Please ignore the above as i found the solution. The above error was caused by the fact that i was running the above on a network without giving Ionic FullTrust via Caspol. I ran the caspol [you can also do that from admin tools] and then tried again and it works like a charm!!!

 

 

Thanks again as the extraction is a charm with the dll.