发信人: dongbao()
整理人: dongbao(2000-10-27 23:44:18), 站内信件
|
Config.web 配置文件
所有ASP+的配置信息都包括在名叫Config.web的配置文件当中。下面的例子说明 了一个ASP+配置文件的结构:
[BLOCKQUOTE]代码:
---------------------------------------------------------------------- ----------
<!-- CONFIG.WEB FILE -->
<configuration>
<configsections>
<add names="httpmodules" type="System.Web.Config.HttpModulesConf igHandler"/>
<add names="httphandlers" type="System.Web.Config.HttpHandlerCon figHandler"/>
<add names="sessionstate" type="System.Web.Config.SessionStateCo nfigHandler"/>
<add names="globalization" type="System.Web.Config.Globalization ConfigHandler"/>
<!-- ADDITIONAL CONFIGSECTION DECLARATIONS GO HERE -->
</configsections>
<httpmodules>
<!-- http module subelements go here -->
</httpmodules>
<httphandlers>
<!-- http handlers subelements go here -->
</httphandlers>
<sessionstate>
<!-- session state subelements go here -->
</sessionstate>
<globalization>
<!-- session state subelements go here -->
</globalization>
<!-- ADDITIONAL CONFIG SECTIONS GO HERE -->
</configuration>
---------------------------------------------------------------------- ----------
[/BLOCKQUOTE]
所有的配置信息都必须居于<configuration>和</configuration>标记之间。配置 文件有两个主要部分。在上部是配置小节的处理程序声明(包括在<configsectio n>和</configsection>标记中)。文件的其余部分包括了实际的配置小节(为了清 楚,它们的子元素已被移除)。注意,下面的每一个配置小节都必须对应有一个< configsection>中的声明存在。每一个声明赋予了配置小节名称并且指出了将处 理其配置信息的NGWS Framework Assembly及Class。每一配置小节包含含有ASP+ 细节配置设定的子元素。
以下代码举例说明了这些概念:
[BLOCKQUOTE]代码:
---------------------------------------------------------------------- ----------
<configuration>
<configsections>
<add name="debugmode" type="System.Web.Config.SingleTagSectionHa ndler" />
<add name="globalization" type="System.Web.Config.SingleTagSecti onHandler" />
<add name="assemblies" type="System.Web.UI.AssembliesSectionHand ler" />
<add name="security" type="System.Web.Config.SecurityConfigHandl er" />
</configsections>
<debugmode enable="true" />
<globalization
requestencoding="us-ascii"
responseencoding="iso-8859-1"
/>
<assemblies>
<add assembly="System.Data.dll"/>
<add assembly="System.dll"/>
<add assembly="System.Drawing.dll"/>
<add assembly="*"/>
</assemblies>
<security>
<authorization>
<allow users="*" /> <!-- Allow all users -->
</authorization>
</security>
</configuration>
---------------------------------------------------------------------- ----------
[/BLOCKQUOTE]
此例说明了一个配置文件,它包含四个配置小节——debugmode,globalization, assemblies以及security。下面是已制定的设置:
*在debug小节,调试模式被打开(设置成true)。
*在globalization小节,设置了请求(Request)和回应(Response)的编码方式。
*在assemblies小节,加入了四个assemblie。
*在security小节,所有用户均被赋予访问权。
-- ICQ:43395237 OICQ:126132
我自豪我用正版,我骄傲我用盗版!!!
※ 来源:.月光程序代码网 http://www.moon-soft.com.[FROM: 202.108.5.176]
|
|