Error permission on temp folder Asp.Net

Mar 30, 2010 at 7:29 AM

Hi,

I'm using your library in Asp.net environment, and I have a problem when I use the method SaveSelfExtractor on a website hosting, this is because seeing the code below, using the method of the framework that I returned on a temporary directory, and I do not have the right to write, and throws the exception System.Security.Permissions.SecurityPermission.

this is your code in ZipFile.SaveSelfExtractor.cs:

internal static string GenerateTempPathname(string extension)
{
string candidate = null;
String AppName = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
string parentDir = System.IO.Path.GetTempPath(); <------------------ exception System.Security.Permissions.SecurityPermission
int index = 0;
do
{
index++;
string Name = String.Format("{0}-{1}-{2}.{3}",
AppName, System.DateTime.Now.ToString("yyyyMMMdd-HHmmss"), index, extension);
candidate = System.IO.Path.Combine(parentDir, Name);
} while (System.IO.File.Exists(candidate) || System.IO.Directory.Exists(candidate));

// this file/path does not exist. It can now be created, as file or directory.
return candidate;
}

is there a way to workaround this error?

Thank you for all
Francesco

Coordinator
Mar 30, 2010 at 4:29 PM

Francesco, I think that may be a problem that you cannot work around, until I fix it.

I'll have to look into it.  

 

Coordinator
Mar 30, 2010 at 4:30 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.