web.config配置文件示例
来源:互联网 发布:台湾海军知乎 编辑:程序博客网 时间:2024/05/16 06:09
为了方便配置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 中,该文件通常位于
WindowsMicrosoft.NetFrameworkv2.xConfig 中
-->
<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>
<?xml version="1.0" encoding="utf-8"?>
<!--
注意: 除了手动编辑此文件以外,您还可以使用
Web 管理工具来配置应用程序的设置。可以使用 Visual Studio 中的
“网站”->“Asp.Net 配置”选项。
设置和注释的完整列表在
machine.config.comments 中,该文件通常位于
WindowsMicrosoft.NetFrameworkv2.xConfig 中
-->
<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>
- web.config配置文件示例
- atlas Web.Config 配置文件
- web.config配置文件
- web.config 配置文件
- web.config 配置文件
- 配置Web.config配置文件
- Web.Config配置文件
- web.config配置文件详解
- Web.config配置文件详解
- Web.config配置文件详解
- 认识Web-config配置文件
- 配置文件Web config
- web.config配置文件说明
- Web.config配置文件详解
- web.config配置文件详解
- web.config配置文件
- Web配置文件(*.config)
- Web.config配置文件详解
- J2ee学习流程
- 第五个设计模式:合成模式
- 呆子的论文
- 利用pio的纯java 操作excel的api
- ObjectBuilder学习(1)
- web.config配置文件示例
- ObjectBuilder学习(2)
- 赢在中国与中国IT培训
- 基于抽象的分层结构
- 从SQL导入到EXCEL方法总结
- 有些倔强
- 公司雇员管理系统
- AJAX实例解析
- 提示1:1月6号婚礼详细地址及行车路线参考