system.web 元素(ASP.NET 设置架构)
<system.web>
<anonymousIdentification> 针对应用程序授权配置匿名标识。这是在需要授权时,对没有经过身份验证的实体进行标识所必需的。
<authentication> 配置 ASP.NET 身份验证支持
<authorization> 配置 ASP.NET 授权支持。
<browserCaps> 配置浏览器功能组件的设置。
<caching> 为 Web 应用程序配置缓存设置。
<clientTarget> 将特定用户代理的别名添加到用户代理别名的内部集合中。
<compilation> 包含 ASP.NET 使用的所有编译设置。
<customErrors> 为 ASP.NET 应用程序定义自定义错误信息。
<deployment> 定义用于支持 Web 应用程序部署的配置设置。
<deviceFilters> 根据用户代理或浏览器指定 ASP.NET MobileCapabilities 类中的设备或设备类。页或应用程序开发人员可以使用设备筛选器来重写控件属性或者定义内容块或模板块以更改布局和外观。
<globalization> 配置应用程序的全球化设置。
<healthMonitoring> 针对运行状况监视配置应用程序。
<hostingEnvironment> 定义用来控制应用程序宿主环境的行为的配置设置。
<httpCookies> 为 Web 应用程序使用的 Cookie 配置属性。
<httpHandlers> 将传入的 URL 请求映射到 IHttpHandler 类。
<httpModules> 添加、移除或清除应用程序中的 HTTP 模块。
<httpRuntime> 配置 ASP.NET HTTP 运行时设置。该节可以在计算机、站点、应用程序或子目录级别声明。
<identity> 控制 Web 应用程序的应用程序标识。
<machineKey> 配置用于加密和解密 Forms 身份验证 Cookie 数据的密钥。该节使您能够配置验证密钥,而验证密钥可以对视图状态数据和 Forms 身份验证票证执行消息身份验证检查。该节可在计算机、站点或应用程序级别声明,但不在子目录级别声明。
<membership> 为 ASP.NET 成员资格配置用于对用户帐户进行管理和身份验证的参数。
<mobileControls> 定义适配器集,以将 ASP.NET 移动控件映射到 Web.config 配置文件的 system.web 节中的相应适配器。
<pages> 标识特定于页的配置设置。
<processModel> 配置 Internet 信息服务 (IIS) Web 服务器系统上的 ASP.NET 进程模型设置。
<profile> 使用 ASP.NET 配置文件来配置用于管理用户值的参数。
<roleManager> 为角色管理配置应用程序。此元素是 .NET Framework 2.0 版中的新元素。
<securityPolicy> 定义命名安全级别与策略文件的有效映射。该节可以在计算机、站点或应用程序级别声明。
<sessionPageState> 为 ASP.NET 应用程序配置页的视图状态设置。
<sessionState> 配置会话状态模块。
<siteMap> 配置导航基础结构支持以配置、存储和呈现站点导航。
<trace> 配置 ASP.NET 跟踪服务。
<trust> 配置用于运行特定应用程序的代码访问安全权限集。该节可以在计算机、站点和应用程序级别声明。
<urlMappings> 定义一个映射,该映射隐藏实际的 URL 并将其映射到用户更容易记忆的 URL。
<webControls> 指定客户端脚本文件的共享位置。
<webParts> 指定 Web 部件个性化设置提供程序、设置个性化设置授权以及添加自定义类(用于扩展 WebPartTransformer 类供 Web 部件连接使用)。
<webServices> 控制使用 ASP.NET 创建的 XML Web services 的设置。
<xhtmlConformance> 配置符合 XHTML 1.0 的控件呈现。
</system.web>
以下是一个 基于vs2008 的更详细的web.config 配置文件
-----------------------------------------
<?xml version="1.0" ?>
<!--
注意: 除了手动编辑此文件以外,您还可以使用Web 管理工具来配置应用程序的设置。
可以使用 Visual Studio 中的"网站"->"Asp.Net 配置"选项。
设置和注释的完整列表在
machine.config.comments 中,该文件通常位于
/Windows/Microsoft.Net/Framework/v2.x/Config 中
-->
<!--configuration根配置节-->
<configuration>
<!--configSections处理声明配置节-->
<configSections>
<!--sectionGroup 分组设置 自定义分组-->
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<!--scripting 脚本语言;脚本撰写;脚本处理-->
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<!--ASP.NET AJAX应用程序在运行时能够对客户端脚本文件进行压缩或缓存,则应该在<sectionGroup name="scripting">
中定义一个新的<section> name叫 scriptResourceHandler-->
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<!--在ASP.NET AJAX应用程序中支持web服务的配置-->
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<!--若ASP.NET AJAX应用程序中需要自定义的JSON转换方式,则应该在<sectionGroup name="webServices">
的最内层中定义相应的<section> name叫jsonSerialization-->
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>
<!--若ASP.NET AJAX应用程序中需要在客户端访问ASP.NET所提供的用户个性化信息服务,则应该在<sectionGroup name="webServices">
中定义这样一个<section> name叫 profileService -->
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<!--若ASP.NET AJAX应用程序中需要在客户端访问ASP.NET所提供的用户身份认证服务,则应该在<sectionGroup name="webServices">
中定义这样一个<section> name叫 authenticationService-->
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<!--让若ASP.NET 支持角色服务-->
<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>
<!--配置ajax web扩展程序 ajax webconfig-->
<system.web.extensions>
<scripting>
<webServices>
</webServices>
<!--以下这段声明将在程序运行于Release模式时压缩客户端脚本库的大小。
如果不是程序中有非常特殊的需要,我们绝对应该添加这个HTTP模块以提高网络传输速度-->
<scriptResourceHandler enableCompression="true" enableCaching="true"/>
</scripting>
</system.web.extensions>
<!--用户自定义配置节-->
<appSettings>
<add key="MyBank.MyBankService" value="http://localhost/FirstWebService/System/MyBankService.asmx"/>
</appSettings>
<!--connectionStrings连接字符串配置节 可以添加多个 连接多个数据库 该字符串可加密-->
<connectionStrings>
<add name="MyBookShop" connectionString="Data Source=ip地址;Initial Catalog=数据库名称;User ID=sa;pwd=" providerName="System.Data.SqlClient"/>
</connectionStrings>
<!--system.web ASP.NET 配置设置 控制asp.net运行时的行为-->
<system.web>
<!--配置网页下载-->
<httpRuntime maxRequestLength="102400" executionTimeout="720"/>
<!--
通过 <authentication> 节可以配置 ASP.NET 用来 识别进入用户的 安全身份验证模式。
-->
<authentication mode="Forms">
<forms name="AdminUser" loginUrl="~/Admin/AdminLogin.aspx" timeout="60"></forms>
</authentication>
<!--
如果在执行请求的过程中出现未处理的错误,
则通过 <customErrors> 节可以配置相应的处理步骤。具体说来,
开发人员通过该节可以配置要显示的 html 错误页以代替错误堆栈跟踪。
-->
<customErrors mode="RemoteOnly" defaultRedirect="~/ErrorPage.htm">
<error statusCode="403" redirect="ErrorPage.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
<pages>
<!--在<configuration>
根元素中的<system.web>
<pages> 节<controls>中注册ASP.NET AJAX服务器端控件的前缀-->
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<!--<add tagPrefix="asp" namespace="Microsoft.Web.Preview.UI" assembly="Microsoft.Web.Preview"/>-->
<!--<add tagPrefix="asp" namespace="Microsoft.Web.Preview.UI.Controls" assembly="Microsoft.Web.Preview"/>-->
</controls>
</pages>
<!-- 设置 compilation debug="true" 可将调试符号插入已编译的页面中。
但由于这会影响性能,因此只在开发过程中将此值设置为 true。-->
<compilation debug="true">
<!--<assemblies> 添加程序集引用-->
<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<!--Ajax扩展控件一定要添加的下面两个-->
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
</assemblies>
</compilation>
<!--若你的ASP.NET AJAX应用程序中需要在客户端调用服务器端的Web Service,
则需要对Web Service应用一些新的HTTP Handler,并为其生成必要的客户端JavaScript代理脚本。
找到<system.web>
元素中的<httpHandlers>
子元素,移除现有的Web Service文件(.asmx)的Handler,然后添加ASP.NET AJAX引入的新的Handler(*.asbx一项同样可以根据需要有选择地添加):-->
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
<!--<add verb="GET,HEAD,POST" path="*.asbx" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>-->
</httpHandlers>
<!--在<system.web>
<httpModules>元素中添加如下的HTTP模块声明 用来控件全局脚本生成-->
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</httpModules>
</system.web>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="OptionInfer" value="true"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
</compilers>
</system.codedom>
<!--
在 Internet 信息服务 IIS7.0 下运行 ASP.NET AJAX 需要 system.webServer
节。对早期版本的 IIS 来说则不需要此节。
-->
<!--在<configuration>
根元素中定义<System.web.extensions> 该配置节点是为Web服务器进行相应的配置子元素,
并在其中定义相应的与上面<sectionGroup> 相呼应的层次结构,如下所示:-->
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<remove name="ScriptModule"/>
<!--配置web服务的全局脚本控制器-->
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated"/>
<remove name="ScriptHandlerFactory"/>
<remove name="ScriptHandlerFactoryAppServices"/>
<remove name="ScriptResource"/>
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<!--<add name="ASBXHandler" verb="GET,HEAD,POST" path="*.asbx" preCondition="integratedMode" type="System.Web.Script.Services. ScriptHandlerFactory,System.Web.Extensions, Version=3.5.0.0, Culture=neutral,PublicKeyToken=31bf3856ad364e35"/>-->
</handlers>
</system.webServer>
<!--<runtime>公共语言运行时配置-->
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>