内容显示页
 
类别:.Net + C# | 浏览(1017) | 2008-8-3 18:08:31

 

<?xml version="1.0"?>
<configuration>
  <configSections>
    <section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter"/>
  </configSections>
  
  <!--URLRewriter重写规则-->
  <RewriterConfig>
    <Rules>
      <RewriterRule>
        <LookFor>~/(\d+).aspx</LookFor>
        <SendTo>~/Default.aspx?page=$1</SendTo>
      </RewriterRule>
    </Rules>
  </RewriterConfig>
  
  
  
  <!--System.Configuration.ConfigurationSettings.AppSettings["SocutDataLink"];-->
  <!--传说中以前.net1.1用这个保存数据库链接,如今可以用这个来保存一些配置-->
  <appSettings>
    <add key="SocutDataLink" value="Data/db1.mdb"/>
    <add key="Domain" value="http://www.yongfa365.com/"/>
    <add key="Author" value="柳永法,yongfa365"/>
  </appSettings>
  
  <!--System.ConfigurationConfigurationManager.ConnectionStrings["SqlConnection"].ProviderName;-->
  <!--System.ConfigurationConfigurationManager.ConnectionStrings["SqlConnection"].ConnectionString;-->
  <!--.net2.0用这个保存数据库链接-->
  <connectionStrings>
    <add name="SqlConnection" connectionString="Data Source=.\SQL2005;Initial Catalog=MSSQLDB;Integrated Security=True" providerName="System.Data.SqlClient"/>
    <add name="SqlConnection2" connectionString="Data Source=.\SQL2005;Initial Catalog=MSSQLDB;Persist Security Info=True;User ID=usr;Password=pwd" providerName="System.Data.SqlClient"/>
    <add name="AccessConnection" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source = D:\Data\mydb.mdb;" providerName="System.Data.OleDb"/>
    <!--<remove name="LocalSqlServer"/>
    <add name="LocalSqlServer" connectionString="Data Source=YONGFA365\SQL2005;Initial Catalog=管理员;Integrated Security=True" providerName="System.Data.SqlClient"/>-->
  </connectionStrings>
  
  


  <system.web>
    <!--调试否,设计设为时true,发布后设为false-->
    <compilation debug="false"/>
    <!--错误显示-->
    <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
      <error statusCode="403" redirect="NoAccess.htm"/>
      <error statusCode="404" redirect="FileNotFound.htm"/>
      <error statusCode="500" redirect="InternalError.htm"/>
    </customErrors>

    <httpModules>
      <add type="URLRewriter.ModuleRewriter, URLRewriter" name="ModuleRewriter"/>
    </httpModules>
    <!--
    <httpHandlers>
     <add verb="*" path="*.aspx" type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
     <add verb="*" path="*.html" type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
    </httpHandlers>
     -->
    
  </system.web>
  
  
  
  <!--■■■■■■■■■■■■■■■■■■■用户、角色配置 start■■■■■■■■■■■■■■■■■■■-->
  <system.web>
    <!--验证模式 mode="[Windows|Forms|Passport|None],一般用Forms"-->
    <authentication mode="Forms">
      <forms loginUrl="login.aspx" name=".CommunityServer"/>
    </authentication>
    <!--为了兼容其它数据库的Provider写的,用的还都是默认的Provider-->
    <membership defaultProvider="SqlMembershipProvider" userIsOnlineTimeWindow="20">
      <providers>
        <add name="SqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="SqlConnection" applicationName="LivePortal" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" requiresUniqueEmail="true" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="1" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"/>
      </providers>
    </membership>
    <profile defaultProvider="SqlProfileProvider">
      <providers>
        <add name="SqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="SqlConnection"/>
      </providers>
    </profile>
    <roleManager defaultProvider="SqlRoleProvider" enabled="true" cacheRolesInCookie="true" cookieName=".ASPROLES" cookieTimeout="30" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration="true" cookieProtection="All">
      <providers>
        <clear/>
        <add name="SqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="SqlConnection" applicationName="LivePortal"/>
      </providers>
    </roleManager>
  </system.web>
  <!--用户,角色 权限[roles|users]="一个逗号分隔的角色或用户列表"-->
  <location path="admin">
    <system.web>
      <authorization>
        <allow roles="管理员,二级管理员,三级管理员"/>
        <deny users="*"/>
      </authorization>
    </system.web>
  </location>
  <location path="ChangePassword.aspx">
    <system.web>
      <authorization>
        <allow users="登录用户,管理员"/>
        <deny users="?"/>
      </authorization>
    </system.web>
  </location>
  <!--配置发送邮件的SMTP信息,为找回密码用-->
  <system.net>
    <mailSettings>
      <smtp from="yongfa365@qq.com">
        <network host="smtp.qq.com" password="64049027" port="25" userName="yongfa365"/>
      </smtp>
    </mailSettings>
  </system.net>
  <!--■■■■■■■■■■■■■■■■■■■用户、角色配置 end■■■■■■■■■■■■■■■■■■■-->
</configuration>

 

<!--■■■■■■■■■■■■■■参考配置,使用时自己调整,无法直接使用■■■■■■■■■■■■-->
<?xml version="1.0"?>
<configuration>
  <!--■■■■■■■■■■■■■■■■■■■伪静态配置 start■■■■■■■■■■■■■■■■■■■-->
  <configSections>
    <section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter"/>
  </configSections>
  <!--URLRewriter重写规则-->
  <RewriterConfig>
    <Rules>
      <RewriterRule>
        <LookFor>~/(\d+).aspx</LookFor>
        <SendTo>~/Default.aspx?page=$1</SendTo>
      </RewriterRule>
    </Rules>
  </RewriterConfig>
  <system.web>
    <httpModules>
      <add type="URLRewriter.ModuleRewriter, URLRewriter" name="ModuleRewriter"/>
    </httpModules>
    <!--
    <httpHandlers>
     <add verb="*" path="*.aspx" type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
     <add verb="*" path="*.html" type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
    </httpHandlers>
     -->
  </system.web>
  <!--■■■■■■■■■■■■■■■■■■■伪静态配置 end■■■■■■■■■■■■■■■■■■■-->
  <!--System.Configuration.ConfigurationSettings.AppSettings["SocutDataLink"];-->
  <!--传说中以前.net1.1用这个保存数据库链接,如今可以用这个来保存一些配置-->
  <appSettings>
    <add key="SocutDataLink" value="Data/db1.mdb"/>
    <add key="Domain" value="http://www.yongfa365.com/"/>
    <add key="Author" value="柳永法,yongfa365"/>
  </appSettings>
  <!--System.ConfigurationConfigurationManager.ConnectionStrings["SqlConnection"].ProviderName;-->
  <!--System.ConfigurationConfigurationManager.ConnectionStrings["SqlConnection"].ConnectionString;-->
  <!--.net2.0用这个保存数据库链接-->
  <connectionStrings>
    <add name="SqlConnection" connectionString="Data Source=.\SQL2005;Initial Catalog=liveportal;Integrated Security=True" providerName="System.Data.SqlClient"/>
    <add name="SqlConnection2" connectionString="Data Source=.\SQL2005;Initial Catalog=MSSQLDB;Persist Security Info=True;User ID=usr;Password=pwd" providerName="System.Data.SqlClient"/>
    <add name="AccessConnection" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source = D:\Data\mydb.mdb;" providerName="System.Data.OleDb"/>
    <!--<remove name="LocalSqlServer"/>
    <add name="LocalSqlServer" connectionString="Data Source=YONGFA365\SQL2005;Initial Catalog=管理员;Integrated Security=True" providerName="System.Data.SqlClient"/>-->
  </connectionStrings>
  <system.web>
    <!--调试否,设计设为时true,发布后设为false-->
    <compilation debug="false"/>
    <!--错误显示-->
    <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
      <error statusCode="403" redirect="NoAccess.htm"/>
      <error statusCode="404" redirect="FileNotFound.htm"/>
      <error statusCode="500" redirect="InternalError.htm"/>
    </customErrors>
  </system.web>
  <!--■■■■■■■■■■■■■■■■■■■用户、角色配置 start■■■■■■■■■■■■■■■■■■■-->
  <system.web>
    <!--验证模式 mode="[Windows|Forms|Passport|None],一般用Forms"-->
    <authentication mode="Forms">
      <forms loginUrl="login.aspx" name=".CommunityServer"/>
    </authentication>
    <!--为了兼容其它数据库的Provider写的,用的还都是默认的Provider-->
    <membership defaultProvider="SqlMembershipProvider" userIsOnlineTimeWindow="20">
      <providers>
        <add name="SqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="SqlConnection" applicationName="LivePortal" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" requiresUniqueEmail="true" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="1" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"/>
      </providers>
    </membership>
    <profile defaultProvider="SqlProfileProvider">
      <providers>
        <add name="SqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="SqlConnection"/>
      </providers>
    </profile>
    <roleManager defaultProvider="SqlRoleProvider" enabled="true" cacheRolesInCookie="true" cookieName=".ASPROLES" cookieTimeout="30" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration="true" cookieProtection="All">
      <providers>
        <clear/>
        <add name="SqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="SqlConnection" applicationName="LivePortal"/>
      </providers>
    </roleManager>
  </system.web>
  <!--用户,角色 权限[roles|users]="一个逗号分隔的角色或用户列表"-->
  <location path="admin">
    <system.web>
      <authorization>
        <allow roles="管理员,二级管理员,三级管理员"/>
        <deny users="*"/>
      </authorization>
    </system.web>
  </location>
  <location path="ChangePassword.aspx">
    <system.web>
      <authorization>
        <allow users="登录用户,管理员"/>
        <deny users="?"/>
      </authorization>
    </system.web>
  </location>
  <!--配置发送邮件的SMTP信息,为找回密码用-->
  <system.net>
    <mailSettings>
      <smtp from="yongfa365@qq.com">
        <network host="smtp.qq.com" password="64049027" port="25" userName="yongfa365"/>
      </smtp>
    </mailSettings>
  </system.net>
  <!--■■■■■■■■■■■■■■■■■■■用户、角色配置 end■■■■■■■■■■■■■■■■■■■-->
</configuration>

 


引用本页地址:http://www.yongfa365.com/item/Web.config.html
 
 
相关链接
 
网友评论:
1 v8800.com - 2011-1-9 2:19:18
平时也有这些,不过没有发到网上来
 
姓名: 记住我
网址:
邮箱:
内容:
验证码:  验证码图片 看不清? 换张图试试
 
     
 
 
文章分类
 
 
.Net + C#(73)
 
 
ASP+VBS(161)
 
 
 
Linux(10)
 
 
 
web 2.0(26)
 
 
 
 
 
心程(68)
 
生活(97)
 
 
     

Power by :柳永法(yongfa365)'Blog  | 京ICP备07011491号  QQ:64049027  E-mail:64049027@qq.com yongfa365'CodePlex yongfa365'CodeGoogle

申请友情链接 要求:跟本站主题相类似正规网站,双方交换为首页位置

转载请注明来源,以便后人及时得到最新、修正、加强版!!!