当前位置:编程学习 > asp >>

ASP.NET杂谈-一切都从web.config说起(1)(开篇)

这个系列在我脑海中已经酝酿了很久,一直没有动手写,今天晚上终于下定决心,抽空也要把他写出来,其实主要是大家一起来探讨和交流ASP.NET编程。

原始的web.config信息


--------------------------------------------------------------------------------


首先我们新建一个ASP.NET Web应用程序,看看VS自动生成的web.config中有那些内容,如下:

   1:  <?xml version="1.0" encoding="utf-8"?>
   2:  
   3:  <configuration>
   4:      <configSections>
   5:        <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
   6:          <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
   7:            <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
   8:            <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
   9:              <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
  10:              <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
  11:              <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
  12:              <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
  13:            </sectionGroup>
  14:          </sectionGroup>
  15:        </sectionGroup>
  16:      </configSections>  
  17:      <appSettings/>
  18:      <connectionStrings/> 
  19:      <system.web>
  20:          <!--
  21:              设置 compilation debug="true" 可将调试符号插入
  22:              已编译的页面中。但由于这会
  23:              影响性能,因此只在开发过程中将此值
  24:              设置为 true。
  25:          -->
  26:          <compilation debug="false">
  27:            <assemblies>
  28:              <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
  29:              <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
  30:              <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
  31:              <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
  32:            </assemblies>
  33:          </compilation>
  34:          <!--
  35:              通过 <authentication> 节可以配置 ASP.NET 用来
  36:              识别进入用户的
  37:              安全身份验证模式。
  38:          -->
  39:          <authentication mode="Windows" />
  40:          <!--
  41:              如果在执行请求的过程中出现未处理的错误,
  42:              则通过 <customErrors> 节可以配置相应的处理步骤。具体说来,
  43:              开发人员通过该节可以配置
  44:              要显示的 html 错误页
  45:              以代替错误堆栈跟踪。
  46:  
  47:          <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
  48:              <error statusCode="403" redirect="NoAccess.htm" />
  49:              <error statusCode="404" redirect="FileNotFound.htm" />
  50:          </customErrors>
  51:          -->
  52:        <pages>
  53:          <controls>
  54:            <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
  55:            <add tagPr

补充:Web开发 , ASP.Net ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,