zoukankan      html  css  js  c++  java
  • 获取配置文件节点的值

    WebConfigurationManager.AppSettings["weburl"]
    //要添加引用“System.configuration“ 
                    //app.config中要追加以下内容: 
                      //<appSettings> 
                      //  <add key="filePath" value="C:\test\"/> 
                      //</appSettings> 
    string path=System.configuration.ConfigurationManager.AppSettings.Get("filePath").ToString();
    using System.Configuration;
    <appSettings>
            <add key="dbhelper_connectionstring" value="ConnectionString = ${connstr}"/>
            <add key="WorkRecordAttention" value="19:53:00"/>
            <add key="WeekRecordAttentionDayOfWeek" value="星期五"/>
            <add key="WeekRecordAttentionTime" value="19:53:00"/>
            <add key="SecondAttentionDayOfWeek" value="星期五"/>
            <add key="SecondAttentionTime" value="19:53:00"/>
            <add key="ThirdAttentionDayOfWeek" value="星期五"/>
            <add key="ThirdAttentionTime" value="19:53:00"/>
        </appSettings>
     workrecordAttentionTime = ConfigurationManager.AppSettings.Get("WorkRecordAttention").ToString();//获取每天日报提醒配置时间
                    weekrecordAttentionTime = ConfigurationManager.AppSettings.Get("WeekRecordAttentionTime").ToString();//获取下周日报提醒配置时间
                    weekrecordAttentionWeek = ConfigurationManager.AppSettings.Get("WeekRecordAttentionDayOfWeek").ToString();//获取下周日报提醒的星期
                    secondAttentionTime = ConfigurationManager.AppSettings.Get("SecondAttentionTime").ToString();//获取第二次提醒配置时间
                    secondAttentionWeek = ConfigurationManager.AppSettings.Get("SecondAttentionDayOfWeek").ToString();//获取第二次提醒的星期
                    thirdAttentionTime = ConfigurationManager.AppSettings.Get("ThirdAttentionTime").ToString();//获取第三次提醒配置时间
                    thirdAttentionWeek = ConfigurationManager.AppSettings.Get("ThirdAttentionDayOfWeek").ToString();//获取第三次提醒的星期
                    MailSender.LoadMailServer(this.GetType().Assembly.Location.Replace("WwoaService.exe", "MailServer.xml"));//获取服务目录
  • 相关阅读:
    修改Nginx的header伪装服务器
    解除与设置计算机锁定
    Adobe flash cs5 的Java运行时环境初始化错误 完美解决方法
    js正则表达式教程
    Eclipse窗口显示:独立、嵌入式
    [置顶] wzplayer for android NEON版本(添加插图)
    买了一块s5pv210 的开发板
    [置顶] android player ,wzplayer for android NEON版本(添加插图)
    make 输出 log 文件
    android player ,wzplayer for android NEON版本(添加插图)
  • 原文地址:https://www.cnblogs.com/haoxr/p/3057210.html
Copyright © 2011-2022 走看看