当前位置: 代码迷 >> ASP.NET >> Web.config的里面的内容能不能分成两个文件写?该怎么解决
  详细解决方案

Web.config的里面的内容能不能分成两个文件写?该怎么解决

热度:8395   发布时间:2013-02-26 00:00:00.0
Web.config的里面的内容能不能分成两个文件写?
我还比较菜,很多基础都不知道

Web.config的里面的内容能不能分成两个文件写?

我用了UrlRewritingNet.UrlRewriter.dll,是个url重写组件
因为要写太多规则,不想都加在Web.config


下面是部分web.config内容:
===========================================================
?xml   version= "1.0 "   encoding= "utf-8 "?>
<configuration>
   
    <!--   URL重写调用1   (共2处)-->  
    <configSections>
        <section   name= "urlrewritingnet "   restartOnExternalChanges= "true "   requirePermission   = "false "   type= "UrlRewritingNet.Configuration.UrlRewriteSection,   UrlRewritingNet.UrlRewriter "   />
    </configSections>

    <!--   URL重写规则   -->
    <urlrewritingnet   rewriteOnlyVirtualUrls= "true "   contextItemsPrefix= "QueryString "   defaultPage   =   "index.aspx "   xmlns= "http://www.urlrewriting.net/schemas/config/2006/07 "   >
        <rewrites>
            <add   name= "TradeInfo "   virtualUrl= "^~/TradeInfo/index "   rewriteUrlParameter= "ExcludeFromClientQueryString "   destinationUrl= "~/TradeInfo/index.aspx "   ignoreCase= "true "   />
            <add   name= "Rule1 "   virtualUrl= "^~/TradeInfo/(\d+) "   rewriteUrlParameter= "ExcludeFromClientQueryString "   destinationUrl= "~/TradeInfo/index.aspx?page=$1 "   ignoreCase= "true "   />
        </rewrites>
    </urlrewritingnet>
   
    <appSettings>
        <add   key= "SocutDataLink "   value= "uid=sa;pwd=admin;database=cdqy;server=.,7788 "/>
    </appSettings>
 
    <connectionStrings>
        <add   name= "cdqyConn "   connectionString= "Data   Source=.,7788;Initial   Catalog=cdqy;Persist   Security   Info=True;User   ID=sa;Password=admin "   providerName= "System.Data.SqlClient "/>
    </connectionStrings>
   
        <system.web>
           
            <!--   URL重写调用2   -->
            <httpModules>
                <add   name= "UrlRewriteModule "   type= "UrlRewritingNet.Web.UrlRewriteModule,   UrlRewritingNet.UrlRewriter "   />
            </httpModules>
           
                <!--  
                        设置   compilation   debug= "true "   将调试符号插入
                        已编译的页面中。但由于这会  
                        影响性能,因此只在开发过程中将此值  
                        设置为   true。
  相关解决方案