天天看點

WebConfig常用配置檔案說明

這裡删除不常用的,隻留下節點

<?xml version="1.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>