网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > ASP.NET技巧
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket
网络编程:ASP教程,ASP.NET教程,PHP教程,JSP教程,C#教程,数据库,XML教程,Ajax,Java,Perl,Shell,VB教程,Delphi,C/C++教程,软件工程,J2EE/J2ME,移动开发
本月文章推荐
.asp.net 2.0 权限树的控制.
..Net下几种日志管理方法.
.在ASP.NET 2.0中使用页面导航控件.
.在ASP.NET页中检测浏览器类型.
.Asp.Net2.0中实现多任务异步页的.
.使Div内内容可编辑.
.ASP.NET提供文件下载函数.
.asp.net 2.0中使用sitemapDATAso.
.asp.net(C#)海量数据表高效率分页.
.Asp.Net的控件如何与Server交互.
.asp.net 2.0小TIPS两则.
.对ASP.NET 2.0下面的新控件的困惑.
.请求网址并解析返回的html.
.再谈使用UrlRewrite时修改form的.
.简述.Net下的应用程序授权实战步.
.语言决不是语法的不同之.NET 版本.
.在asp.net中实现删除DataGrid的某.
.Lucene.net试用.
.ASP.NET2.0中使用数据源控件之基.
.扩展 IronPython for ASP.NET:编.

web.config配置文件示例

发表日期:2006-10-5


为了方便配置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>
http://www.cnblogs.com/andymore/archive/2006/10/03/520759.html

上一篇:.NET编程规范 人气:4794
下一篇:编程实现QQ表情文件CFC格式 人气:5135
浏览全部web.config的内容 Dreamweaver插件下载 网页广告代码 祝你圣诞节快乐 2009年新年快乐