摘要:
编写程序的时候,经常需要用的项目根目录。自己总结如下1、取得控制台应用程序的根目录方法 方法1、Environment.CurrentDirectory 取得或设置当前工作目录的完整限定路径 方法2、AppDomain.CurrentDomain.BaseDirectory 获取基目录,它由程序集冲突解决程序用来探测程序集2、取得Web应用程序的根目录方法 方法1、HttpRuntime.AppDomainAppPath.ToString();//获取承载在当前应用程序域中的应用程序的应用程序目录的物理驱动器路径。用于App_Data中获取 方法2、Server.MapPath("& 阅读全文
posted @ 2011-11-09 17:46
Randolph Liu
阅读(165)
评论(0)
推荐(0)
摘要:
代码如下: //编辑web.config文件 //打开配置文件 Configuration config = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration( "~ "); //获取appsettings节点 AppSettingsSection appsection = (AppSettingsSection)config.GetSection( "appSettings "); //在appsettings节点中添加元素 ... 阅读全文
posted @ 2011-11-09 11:19
Randolph Liu
阅读(1549)
评论(0)
推荐(0)

浙公网安备 33010602011771号