2013-05-28 75 views
1

我有一個ASP.NET MVC3應用程序,其中路由配置的方式是,所有到/UsersRequests的請求都由一個控制器提供服務,而到/ServiceRequests的所有請求都由另一個控制器提供,處理方式稍有不同。我可以單獨更改ASP.NET MVC3中不同路由的web.config設置嗎?

現在我需要更改在web.config中配置的<system.webServer><security><access sslFlags>屬性。如果我在根級別執行此操作,它會產生一些不良影響,所以我只希望將其更改爲/ServiceRequests路徑。

這樣的路線變化是否可能?

回答

0

這可以使用<location>元件來實現:

<?xml version="1.0"?> 
<configuration> 
    <!-- other sections here --> 
    <location path="ServiceRequests"> 
    <system.webServer> 
     <security> 
     <!-- here goes the value that is changed for 
      this location only 
     --> 
     <access sslFlags="SslNegotiateCert"/> 
     </security> 
    </system.webServer> 
    </location> 
    <system.webServer> 
    <!-- all the usual stuff goes here and only the stuff 
     mentioned under "location" above will be overriden 
     by values specified in there 
    --> 
    </system.WebServer> 
</configuration> 
相關問題