天天看点

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>