通过更新配置文件在Windows 7中进行授权错误 [英] Authorization error in windows 7 by updating configuration file

查看:68
本文介绍了通过更新配置文件在Windows 7中进行授权错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好大家



i我用以下功能更新配置文件

hello everyone

i am updating configuration file with the following function

private void UpdateConfig(string value)
        {
            Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            //ConfigurationManager.

            AppSettingsSection appSettings = config.AppSettings as AppSettingsSection;


            
            // Get the KeyValueConfigurationCollection  
            // from the configuration.
            KeyValueConfigurationCollection settings =
              config.AppSettings.Settings;

            // Display each KeyValueConfigurationElement. 
            foreach (KeyValueConfigurationElement keyValueElement in settings)
            {
                if (keyValueElement.Key == "dbConnectionString")
                {
                    keyValueElement.Value = value;
                }
            }

            config.Save(ConfigurationSaveMode.Modified);
            ConfigurationManager.RefreshSection("appSettings");
        }



i通过更新配置文件获取授权异常

i不想让用户手动更改Windows上的授权用户级别我想在应用程序中使其正确,请向我提出任何解决方案。


i am getting authorization exception by updating configuration file
i don''t want to do that user manually change authorization on windows user level i want to make it correct in application kindly suggest me any solution.

推荐答案

试试这个:



Try this:

Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal);


这篇关于通过更新配置文件在Windows 7中进行授权错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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