关于我们 广告服务 社区论坛
设为首页 加入收藏

行业新闻
服 务 器
模版下载
建站指南
冲浪宝典
办公软件
网站运营
操作系统
QQ 专题
网页制作
安全防御
视频教程
网络编程
SEO专区
软件下载
图像设计
Cisco
网页特效
Wap 技术
联盟赚钱
网页素材
 首页 | 企业建站 | 网页制作 | 网站运营 | 网络编程 | 图像设计 | 冲浪宝典 | 操作系统 | SEO专区 | 联盟赚钱 | Cisco

欢迎来到e天下网络首页>>网络编程>>ASPNET>>正文|web.config配置文件示例

web.config配置文件示例

[ 来路:21kn.com    时间:2007-7-8 17:39:05    点击: ]

 

为了方便配置web.config文件,我写了一个常用的web.config文件的示例,可以以此为模版根据需要修改。
创建web.config文件的三种快捷方法:
    1、用VS2005中的asp.net网站配置工具配置
    2、参考C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727(.net framework版本)\CONFIG\目录下的machine.config 文件进行编写
    3、以下边这个文件作模版修改


点击此处展开代码
<?xml version="1.0" encoding="utf-8"?>
<!--
    注意: 除了手动编辑此文件以外,您还可以使用
    Web 管理工具来配置应用程序的设置。可以使用 Visual Studio 中的
     “网站”->“Asp.Net 配置”选项。
    设置和注释的完整列表在
    machine.config.comments 中,该文件通常位于
    \Windows\Microsoft.Net\Framework\v2.x\Config 中
-->
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
  <appSettings>
    <!-- Enable data caching -->
    <add key="EnableCaching" value="true"/>
  </appSettings>
  <connectionStrings>
    <add name="strConnUserDB"
         connectionString="Data Source=.;Initial Catalog=profile1;Integrated Security=True"
         providerName="System.Data.SqlClient" />
  </connectionStrings>
  <system.web>

    <membership>
      <providers>
        <remove name="AspNetSqlMembershipProvider" />
        <add name="AspNetSqlMembershipProvider"
             type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
             connectionStringName="strConnUserDB"
             enablePasswordRetrieval="false"
             enablePasswordReset="true"
             requiresQuestionAndAnswer="true"
             applicationName="/"
             requiresUniqueEmail="false"
             passwordFormat="Hashed"
             maxInvalidPasswordAttempts="5"
             minRequiredPasswordLength="7"
             minRequiredNonalphanumericCharacters="1"
             passwordAttemptWindow="10"
             passwordStrengthRegularExpression=""
             description="存储membership数据"
         />
      </providers>
    </membership>
    <profile enabled="true" defaultProvider="AspNetSqlProfileProvider" inherits="">
      <providers>
      <remove name="AspNetSqlProfileProvider" />
      <add name="AspNetSqlProfileProvider"
            connectionStringName="strConnUserDB"
            applicationName="/"
            type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
            description="存储Profile数据"
         />
      </providers>
       <properties>
        <add name="Name"/>
        <add name="BackColor" type="System.Drawing.Color" allowAnonymous="true" serializeAs="Binary"/>
      </properties>
    </profile>
   
    <roleManager enabled="true" cacheRolesInCookie="true">
      <providers>
        <remove name="AspNetSqlRoleProvider" />
        <add name="AspNetSqlRoleProvider"
        connectionStringName="strConnUserDB"
        applicationName="/"
        type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
        description="存储Role数据"
          />
      </providers>
    </roleManager>
    <!-- Other roleManager attributes (and their defaults) include:
            cookieName=".ASPXROLES"       
            cookieTimeout="30"
            cookiePath="/"       
            cookieRequireSSL="false"       
            cookieSlidingExpiration="true"  // Renew expiring cookies?
            createPersistentCookie="false"  // Issue persistent cookie?
            cookieProtection="All" />          // Cookie protection level
     -->
    <compilation debug="false" />
    <authentication mode="Forms" />
    <!--
        <anonymousIdentification
            enabled="true"
            cookieName=".ASPXANONYMOUS"
            cookieTimeout="43200"
            cookiePath="/"
            cookieRequireSSL="false"
            cookieSlidingExpiration="true"
            cookieProtection="All"
            cookieless="UseCookies"
         />
     -->   
    <!--
        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
     -->
  </system.web>
  <location path="user">
    <system.web>
      <authorization>
        <allow roles="?" />
        <deny users="*"/>
      </authorization>
    </system.web>
  </location>
</configuration>

::::站长友情提示:多花一分钟学点什么都好::::

 

上一篇:asp.net 2.0中不同web控件之间的相互调用  下一篇:关于线程的参数、“返回值”、及线程的中止

 ::热点信息::

 

= = 免责声明 = =

① 欢迎转载我网所刊信息,请注明“来源:E天下网络”。
② 凡本网注明“来源:XXX(非E天下网络)”的作品,均转载自其它媒体,转载目的在于传递更多信息,并不代表本网赞同其观点和对其真实性负责。如因作品内容、版权和其它问题需要同本网联系的,请在30日内进行。
※联系方式:Airtofly@163.com

::推荐文章::

 

ASP教程:详细学习ASP的内置对象

::图像设计::

 

动态图片搜索家——GIF RUNN
软件搜索利器——FileFerret
实例说明构图要讲规律
Character Builder让你尽展靓
全景图速成者Cool360
三维模型速成工具——Canoma
剪贴专家SmartBoard 32
新世纪的图像处理利器——Ph
更多内容..

 

 

关于我们 广告服务 友情链接 合作伙伴 社区论坛 免责声明

Copyright © 2007   21kn.com Inc. All rights reserved.e天下网络工作室

网站白天客服QQ:26875416 (非24小时)  合作QQ:597004688    粤ICP备06026423号