This project is read-only.

Requested registry access not allowed in ASP.Net

Nov 10, 2009 at 2:09 AM

I'm getting the following error/stack trace:

Requested registry access is not allowed.
at System.ThrowHelper.ThrowSecurityException(ExceptionResource resource)
at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)
at System.Environment.GetEnvironmentVariable(String variable, EnvironmentVariableTarget target)
at SevenZip.SevenZipCompressor..ctor()

This happens when I try to use the compress functions.  I do not see the error when expanding 7z files.

Section of code that is getting the error (ASP.Net/2.0/C#):

SevenZipCompressor.SetLibraryPath(HttpContext.Current.Server.MapPath("~/bin/7z.dll"));
SevenZipCompressor compressor = new SevenZipCompressor();
compressor.ScanOnlyWritable = true;
compressor.CompressionLevel = CompressionLevel.High;
compressor.CompressFiles(@"C:\Temp\Test.7z", @"C:\Temp\Test.txt");
compressor = null;

A Process Monitor trace shows that w3wp.exe is trying to RegOpenKey HKU\S-1-5-20\Environment and getting Access Denied.

Any suggestions?

Feb 6, 2010 at 6:06 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.