ASP.NET配置

  <appSettings>小节用于应用程序的自定义设置,主要应用范围是:网站设置.软硬件环境设置.应用程序主要功能参数设置.(public sealed class AppSettingsSection:ConfigurationSection),appSettings配置节为应用程序提供string值的键/值对.不要使用AppSettingsSection对象的实例访问这些值,而应使用ConfigurationManager类的AppSettings属性或WebConfigurationManager类的AppSettings属性(public static class ConfigurationManager/WebConfigurationManager,对于这两类,我这是得介绍一下,访问修饰符public/internal/protected/private public在整个应用程序中可以访问,internal一个程序集,static 修饰这个类,静态类中不需要实例化就可以访问)
<appSettings>
<add key="设置的关键字1" value="关键字1的值"/>
<add key="设置的关键字2" value="关键字2的值/>
</appSettings>
<configuration>
<appSettings>
<add key="con" value="server=server;database=database1;uid=sa;pwd="/>
<add key="sn" value="9u0ufadfapffa6f4as" />
</appSettings>
</configuration>

配置<httpRuntime>
<httpRuntime>小节配置ASP.NET HTTP运行库.该小节可以在计算机,站点,应用程序和子目录级别声明.
<configuration>
<system.web>
<httpRuntime maxRequestLength="4000" useFullyQualifiedRedirectUrl="true" executionTimeout="45" />
//appRequestQueueLimit将为应用程序排队的请求的最大数目
//excutionTimeout:指示在被ASP.NET自动关闭前,允许执行请求的最大秒数
//maxRequestLength支持最大文件的上传
</system.web>
</configuration>

Machine.Config文件是根配置文件,提供整台机器的默认配置设置.当一个应用程序创建时,会自动从Machine.Conifg文件中复制一部分配置代码作为Web.Config来对程序进行配置.应该说,Machine.Config是应用程序运行的模板,在Web.Conifig没有进行设置的内容都将从Machine.Config中获取.
配置<httpModules>
<httpModules>小节在一个应用程序内配置HTTP模块
<httpModules>
<add type="classname,assemblyname" name="modulename" />//type类名,程序集,add 将HttpModules添加到应用程序
<remove name="modulname" />//从应用程序移除HttpModule类
<clear />//从应用程序移除所有HttpModule映射
<httpModules>
示例:
<configuration>
<system.web>
<httpModules>
<add type="System.Web.Caching.OutputCacheModule" name="OutputCache" />
<add type="System.Web.SessionState.SessionStateModule" name="Session" />
<add type="Selector,selector.dll" name="Selector" />
<httpModules>
</system.web>
</configuration>

配置<pages>
<pages>小节标识特定于页的配置设置.<pages>小节可以在计算机,站点,应用程序和子目录级别声明
<pages buffer="true/false" enableSessionState="true/false/ReadOnly" enableViewState="true/false" autoEventWireup="true/false" pageBaseType="typename,assembly" userControlBaseType="typename" />

还有很多种配置,这里只例举几种重要的.可以发E-Mail给偶


转载于:https://www.cnblogs.com/izxp/archive/2006/11/28/575559.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值