• 配置文件记录(1)


    1、配置文件的继承性:
    每一个web.config文件都会将其配置设置应用于本身所在的目录及其下的所有子目录。
    子目录的web.config文件继承父目录的配置设置
    子目录的配置文件设置会重写或修改父目录中相同的配置设置。
    2、配置文件的格式
    <?xml version="1.0' encoding="utf-8"?>
    <configuration>
         <system.web>
            <compilation defaultLanguage="vb" debug="true"/>
            <customErrors mode="RomoteOnly"/>
            <authentication>
                <allow users="*"/>
            </authentication>
        </system.web>
    </configuration>
    3、配置文件的结构
    (1)<configSections>配置段
    用于指定<configSection>处理程序,后者是一个函数,用于解释web.config配置文件中的XML,并将信息返回给的用户。
    该配置段在需要添加自定义配置文件处理程序时使用。语法如下:
    <?xml version="1.0" encoding="jtf-8"?>
    <configuration>
        <section name="[SectionSettings]" type="[Class]"/>
        <sectionGroup name="[SectionGroup]">
                <section name="[SectionSettings"] type="[Class]"/>
         </sectionGroup>
    </configuration>
    (2)<appSection>配置段
    <appSection>配置段用于存储自定义的系统级应用程序设置,这些设置将返回一个基于字符串的值。以下是一个<appSection>配置段的范例。
    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
        <appSections>
            <add key="appName" value="ProjectName"/>
            <add key="appAuthor" value="Jakie W"/>
        </appSections>
    </configuration>
    (3) <system.web>
    通过该配置段可以控制asp.net应用程序的行为模式。
    (4) <location> 锁定配置设置
    通常情况下,子目录的配置设置为重写父目录的配置文件同的配置设置,如果希望较高层次中的某元素的配置设置不被较低层次目录的配置文件所重写或更改,只需将该配置设置包含与<location>与</location>标记中,并在<location> 中加入allowOverride="false" 的属性设置以便锁定该配置设置。
    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
    <location path="file" allowOverride="false">
        <system.web>
            <compilation defaultLanguage="vb" debug="true"/>
            <customErrors mode="RomoteOnly"/>
            <authentication>
                <allow users="*"/>
            </authentication>
        </system.web>
    </location>
    </configuration>



  • 相关阅读:
    ftp 下载最近一小时的文件
    hdu4767 Bell——求第n项贝尔数
    Uva11762 Race to 1——有向无环图&&记忆化搜索
    P3232 [HNOI2013]游走——无向连通图&&高斯消元
    Random Walk——高斯消元法
    B君的历史——复数乘法&&爆搜
    复数快速幂【模板】
    UVa11542Squre——异或方程组&&高斯消元法
    UVa10828 Back to Kernighan-Ritchie——概率转移&&高斯消元法
    高斯消元法【模板】
  • 原文地址:https://www.cnblogs.com/wzyexf/p/348481.html
Copyright © 2020-2023  润新知