易截截图软件、单文件、免安装、纯绿色、仅160KB

ASP.NET操作web.config

      ASP.NET可以利用WebConfigurationManager和直接利用XML方式操作web.config,WebConfigurationManager比较简单,但是清除注释代码。两者操作方式都需要有写权限。
      方法一,利用WebConfigurationManager,需要引用System.Web.Configuration.WebConfigurationManager;
     添加项:
     Configuration config = WebConfigurationManager.OpenWebConfiguration(null);
     AppSettingsSection app = config.AppSettings;
    app.Settings.Add("key", "valueadd");
    config.Save(ConfigurationSaveMode.Modified);
  
     修改项:
     Configuration config = WebConfigurationManager.OpenWebConfiguration(null);
     AppSettingsSection app = config.AppSettings;
     app.Settings["key"].Value = "valuemodify";
     config.Save(ConfigurationSaveMode.Modified);
     删除项:
     Configuration config = WebConfigurationManager.OpenWebConfiguration(null);
     AppSettingsSection app = config.AppSettings;
     app.Settings.Remove("key");
     config.Save(ConfigurationSaveMode.Modified);
     修改连接项:
      Configuration config = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
ConnectionStringsSection conSection = (ConnectionStringsSection)config.GetSection("connectionStrings");
conSection.ConnectionStrings[Request["type"].ToString()].ConnectionString = Request["connstr"];
config.Save(ConfigurationSaveMode.Modified);
 XmlDocument xmldoc = new XmlDocument();
            string filename = Common.FilePath("../web.config");
    &nbs


相关文档:

Asp.Net中sql server 2000/2005 连接字符串


http://zhanglei1286.blog.163.com/blog/static/1895797120091112113019600/
在后台代码里:
SQL 2000:
static string StrConn = "server=.;uid=sa;pwd=sa;database=MyCUDS";
SQL2005:
con = new SqlConnection(@"Server=.\SQLExpress;Database=db_CMS;Persist Security Info=True;User ID=sa;Password=Masslong"); ......

Asp.Net技巧精萃

在网上搜集整理的资料,希望对大家有所帮助
1.<%=...%>与<%#... %>的区别:
  答:<%=...%>是在程序执行时调用,<%#... %>是在DataBind()方法之后被调用
2.控件接收哪些类型数据?
  答:接收Bind的控件,一般有dropDownList,DataList,DataGrid,ListBox这些集合性质的控件,而被捆绑  ......

asp.net 获取客户端计算机名

asp.net 获取客户端计算机名
1. 在ASP.NET中专用属性:
获取服务器电脑名:Page.Server.ManchineName
获取用户信息:Page.User
获取客户端电脑名:Page.Request.UserHostName
获取客户端电脑IP:Page.Request.UserHostAddress
2. 在网络编程中的通用方法:
获取当前电脑名:static System.Net.Dns.GetHostNam ......

用ASP.NET做简易计算器和九九乘法表

简易计算器
 
 
1.在页面上放入TextBox控件和dropdownlist控件以及Button控件,形成下图的外观.
 
 
 
 
 
 
 
2.在做好页面后双击Button控件(即"="),写入如下代码:
 
using System;
using System.Collections.Generic;
using System.Linq;
using System ......

asp.net母版页使用控件时,控件中路径问题

刚刚在headmenu控件里面写了一个导航条,用到了本地的图片,在控件中显示良好,可是放到母版式页后,发现导航条背景图片没了,于是仔细检查了下图片的url,我用的是绝对路径,难道放在主页上后,路径也改变了,上网查了下,还真是这个问题,图片在控件里面看不到没关系,关键是要在母版式页能看到就行,路径都要根据母版页的写. ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号