Requested registry access not allowed in ASP.Net

Nov 10, 2009 at 1: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 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 5:06 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.