1usingSystem;
2usingSystem.Data;
3usingSystem.Configuration;
4usingSystem.Collections;
5usingSystem.Web;
6usingSystem.Web.Security;
7usingSystem.Web.UI;
8usingSystem.Web.UI.WebControls;
9usingSystem.Web.UI.WebControls.WebParts;
10usingSystem.Web.UI.HtmlControls;
11usingSystem.Xml;
12
13publicpartialclassDefault2: System.Web.UI.Page
14{
15protectedvoidPage_Load(objectsender,EventArgse)
16 {
17 Configurationconfig = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
18
19 //操作appSettings
20 AppSettingsSectionappseting = (AppSettingsSection)config.GetSection("appSettings");
21 appseting.Settings["web"].Value ="zsq"; //修改设置
22 appseting.Settings.Add("name","sq"); //增加设置
23
24 //操作connectionStrings
25 ConnectionStringsSectionconSection = (ConnectionStringsSection)config.GetSection("connectionStrings");
26 conSection.ConnectionStrings["constr"].ConnectionString ="~/App_Data/shaoqun.mdb"; //修改设置
27 conSection.ConnectionStrings["constr"].ProviderName ="System.Data.OleDb";
28 conSection.ConnectionStrings.Add(newConnectionStringSettings("constr2","aaaaa","System.Data.OleDb"));//增加设置
29
30 config.Save();
31 }
32}
分享到:
相关推荐
asp.net配置web.config数据库连接asp.net配置web.config数据库连接asp.net配置web.config数据库连接
asp.net中web.config配置节点大全详解
方便加密或者解密asp.net mvc网站web.config文件中的数据库连接串。加密后即使黑客拿到web.config文件也看不到你的数据库连接串,增加网站和数据库安全!有了这个工具,就不用记那些晦涩的dos命令拉
ASP.NET的Web.Config文件中的元素
asp.net2.0的web.config的配置教学,全部是自己一个人作品的做的,绝对不是拿人家的上传的
asp.net中的web.config认识 应用
收集的资料,分享给大家,不熟悉的道友可以看看,适合新入坑的,^_^
ASP.NET 配置文件 Web.config详细解释 认识Web.config文件 web.config配置文件(默认的配置设置) 等等
web.config是asp.net应用程序中一个很重要的配置文件,通过web.config文件可以方便我们进行开发和部署asp.net应用程序。此外还能对程序进行一些灵活的控制。在本篇中详细讲述了各节点的作用。
web.config配置
Asp.Net2.0读取-修改-新增(配置文件web.config)可以是 ***.config里面有3个文件操作类,System.config,使用文档
ASP.NET配置文件Web.config <br>
Web.config文件是一个XML文本文件,它用来储存 ASP.NET Web 应用程序的配置信息(如最常用的设置ASP.NET Web 应用程序的身份验证方式),它可以出现在应用程序的每一个目录中。当你通过VB.NET新建一个Web应用程序后...
主要为大家详细介绍了ASP.NET Web.config配置文件,教大家如何配置Web.config文件,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
asp.net连接sql数据库web.config配置,要的快快下载,里面有详细的参数说明
asp.net网页开发配置文件设置详解,便于初学者学习参考。
自己看吧,ASP.NET配置文件Web.config 详细解释
<system.web> 实际ASP.NET配置设置的根元素 <!-- 动态调试编译 设置 compilation debug="true" 以启用 ASPX 调试。 否则,将此值设置为 false 将提高此应用程序的运行时性能。 设置 compilation debug="true" 以...