拒绝访问路径"\ web.config". [英] Access to the path '\web.config' is denied.

查看:107
本文介绍了拒绝访问路径"\ web.config".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
从代码文件向web.config文件添加新的连接字符串时.发生以下错误.如何纠正此问题.代码如下.

Hi all,
when adding a new connection string to the web.config file from code file. the following error is occurred. how to rectify this problem.Code is as follows.

System.Configuration.Configuration configuration = WebConfigurationManager.OpenWebConfiguration("~");
        //        AppSettingsSection appSettingsSection = (AppSettingsSection)configuration.GetSection("connectionStrings");
        //        if (appSettingsSection != null)
        //        {
        //            appSettingsSection.ConnectionStrings[key].ConnectionString = value; = "Data Source=" + DbServerName+ ";Initial Catalog=" + DbName+ ";User ID=" + DbUserName + ";Pwd=" +DbUserPass+ "";
        //            configuration.Save();

推荐答案

写入web.config文件的提示错误访问路径


请通过在运行时以编程方式编写修改Web.Config时间 [ ^ ],并尝试实施此处给出的代码.

这可能会有所帮助.

谢谢...
Please go through Write Modify Web.Config Programmatically At Run Time[^] and try to implement the codes given there.

It may help.

Thanks...


这篇关于拒绝访问路径"\ web.config".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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