WebConfig常用配置文件说明

这里删除不常用的,只留下节点
<?xml version="1.0"?>

<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">

  <configSections>
  </configSections>
  <appSettings>
    <add key="identifier" value="63B362AB3FE9FA8DEEB2C1E3889274A30" />
  </appSettings>

  <!--连接数据库字符串-->
  <connectionStrings>
    <add name="LocalSqlServer" connectionString="Server=.;database=XXX;uid=xx;pwd=xxxxxxxxxxxxx;" />
  </connectionStrings>
  <microsoft.web>
    <converters>
     </converters>
    <webServices enableBrowserAccess="true"/>
    <profileService enabled="true" setProperties="bulletin" getProperties="bulletin" />
  </microsoft.web>

  <system.web>
    <!--<anonymousIdentification enabled="true"/>-->
<!-- 这里为profile信息 -->
    <profile >
      <properties>
        <add name="xxxx" defaultValue="暂无消息"/>
        </properties>
    </profile>
    <!-- 以下为WebParts的配置 -->
    <webParts>
      <personalization >
        <providers>
          <add connectionStringName="LocalSqlServer" applicationName="/" name="AspNetSqlProvider" type="System.Web.UI.WebControls.WebParts.SqlPersonalizationProvider"/>
        </providers>
        <authorization>
<!--<allow roles="user" verbs="enterSharedScope"/>--><!--Share模式开启,不开启时可开户User模式-->
          <deny roles="anonymous" verbs="modifyState"/>
          <allow roles="aa,bb" verbs="modifyState"/>
        </authorization>
      </personalization>
    </webParts>
    <!-- 以下为MemberShip的配置-->
    <membership defaultProvider="AspNetSqlProvider">
      <providers>
        <add connectionStringName="LocalSqlServer" applicationName="/"  description="something about Membership" requiresUniqueEmail="false" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" enablePasswordRetrieval="false" enablePasswordReset="true" passwordFormat="Hashed" name="AspNetSqlProvider" type="System.Web.Security.SqlMembershipProvider"/>
      </providers>
    </membership>
    <pages theme="Silver"><!-- 页面主题设置-->
      <controls>
       </controls>
    </pages>

    <compilation debug="true"><!--发布时设成false -->
      <buildProviders>
       </buildProviders>
      <assemblies>
        </assemblies>
    </compilation>
        <httpHandlers>
        </httpHandlers>
    <httpModules>
     </httpModules>

  <!-- 验证模式-->
    <authentication mode="Forms">
      <forms name="xxx.xxx.net/com" loginUrl="Login.aspx/default.aspx"></forms>
    </authentication>
    <!--配置网页出错信息与出错显示页面   -->
    <customErrors mode="RemoteOnly" defaultRedirect="ErrorPage.htm">
      <error statusCode="403" redirect="NoAccess.htm"/><!-- 可自己添加错误信息与错误页面-->
      <error statusCode="404" redirect="FileNotFound.htm"/>
    </customErrors>

  </system.web>
  <!-- 以下节点作用一个页面的访问权限,可写多个,也可去掉第一句话,在一个文件夹放webconfig对整个文件夹起作用  -->
<!--
  <location path="xxx.aspx">
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>   
  </location>
  -->
</configuration>

你可能感兴趣的:(WebConfig常用配置文件说明)