heisetoufa 发表于 2013-2-4 19:54:40

System.UnauthorizedAccessException: 无法写入到注册表项

C#操作注册表,在写入注册表值的时候报错

System.UnauthorizedAccessException: 无法写入到注册表项

给OpenSubKey()方法给第2个参数设置为true就可以了,第2个参数为true代表可读可写注册表

RegistryKey hkml = Registry.CurrentUser;RegistryKey aimdir = hkml.OpenSubKey("Asp Net Settings",true);

黑色头发:http://heisetoufa.iteye.com
页: [1]
查看完整版本: System.UnauthorizedAccessException: 无法写入到注册表项