Registry.LocalMachine.OpenSubKey()返回null [英] Registry.LocalMachine.OpenSubKey() returns null

查看:1495
本文介绍了Registry.LocalMachine.OpenSubKey()返回null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到一个空回来从这个尝试访问Windows注册表:

I get a null back from this attempt to access the Windows Registry:

using (RegistryKey registry = Registry.LocalMachine.OpenSubKey(keyPath))

的keyPath是 SOFTWARE \\\\密押

关键是在注册表中,那么为什么不是本地计算机配置单元下找到它?

The key is in the registry, so why is it not finding it under the Local Machine hive?

推荐答案

在德纳您的评论你说你给了ASP.NET帐户的访问。不过,你确认这是该帐户的网站下运行?冒充和匿名访问用户可以很容易被忽视。

In your comment to Dana you said you gave the ASP.NET account access. However, did you verify that that is the account that the site in running under? Impersonate and the anonymous access user can be easy to overlook.

UNTESTED code:

UNTESTED CODE:

Response.Clear();  
Response.Write(Environment.UserDomainName + "\\" + Environment.UserName);  
Response.End();

这篇关于Registry.LocalMachine.OpenSubKey()返回null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆