读取webconfig中的mailSettings的一个大小写字母问题

Code

就是system.net/mailSettings中的system我写成了System导致了一直出错,表面上看都没区别,但是要小心啊。

指定使用默认网络凭据发送电子邮件时所需的适当 SMTP 参数:

<configuration>
  <system.net>
    <mailSettings>
      <smtp deliveryMethod="network" from="ben@contoso.com">
        <network
          host="localhost"
          port="25"
          defaultCredentials="true"
        />
      </smtp>
    </mailSettings>
  </system.net>
</configuration>

 

 

 

ASP.NET 配置文件为 XML 文件。.NET Framework 定义了一组实现配置设置的元素,并且 ASP.NET 配置架构包含控制 ASP.NET Web 应用程序的行为的元素。

默认配置设置在位于 %SystemRoot%\Microsoft.NET\Framework\versionNumber\CONFIG\ 目录中的 Machine.config file 文件中指定。值由子站点和应用程序继承。如果子站点或应用程序中有配置文件,则继承的值不会出现,但可以被重写并可用于该配置 API。

本节描述可以在 Machine.config 文件和应用程序特定的 Web.config 文件中配置的 ASP.NET 配置架构元素。此部分的目录反映了架构的层次结构

 

<system.web>
   <anonymousIdentification>
   <authentication>
   <authorization>
   <browserCaps>
   <caching>
   <clientTarget>
   <compilation>
   <customErrors>
   <deployment>
   <deviceFilters>
   <globalization>
   <healthMonitoring>
   <hostingEnvironment>
   <httpCookies>
   <httpHandlers>
   <httpModules>
   <httpRuntime>
   <identity>
   <machineKey>
   <membership>
   <mobileControls>
   <pages>
   <processModel>
   <profile>
   <roleManager>
   <securityPolicy>
   <sessionPageState>
   <sessionState>
   <siteMap>
   <trace>
   <trust>
   <urlMappings>
   <webControls>
   <webParts>
   <webServices>
   <xhtmlConformance>
</system.web>

posted @ 2009-04-25 10:52  newos  阅读(957)  评论(0编辑  收藏  举报