出现一个奇怪的问题:有段代码是写注册表的,当用VS2005 运行时一切正常,但是在iis中运行时就出现错误,以下为写注册表的代码:
public void WriteReg(string key, string value)
{
try
{
RegistryKey rootKey = Registry.LocalMachine.CreateSubKey(regSubKey);
rootKey.SetValue(key, value);
rootKey.Close();
}
catch (Exception)
{
throw;
}
}
在iis中运行时,出现下面的错误:
Access to the registry key 'HKEY_LOCAL_MACHINE\SOFTWARE\Uni\Register' is denied. 谢谢!
public void WriteReg(string key, string value)
{
try
{
RegistryKey rootKey = Registry.LocalMachine.CreateSubKey(regSubKey);
rootKey.SetValue(key, value);
rootKey.Close();
}
catch (Exception)
{
throw;
}
}
在iis中运行时,出现下面的错误:
Access to the registry key 'HKEY_LOCAL_MACHINE\SOFTWARE\Uni\Register' is denied. 谢谢!
如果guest账户都可以操作注册表,那还谈什么安全?
<identity impersonate="true">
http://support.microsoft.com/?kbid=306158