我需要一些新的生活增添到遺留應用程序:)調用ASP.NET MVC控制器當請求.html文件
我想打電話的MVC控制器時,在請求一個「靜態」的HTML頁面爲了在將頁面返回給客戶端之前添加一些標記。
我試圖按照此線索找到了方法:How to read web.config settings in .html page?
...但即使我已經定義這條路線:
routes.MapRoute(
name: "Topic",
url: "html/{fileName}.html",
defaults: new { controller = "Topic", action = "Index" });
控制器不會被調用。我有我的web.config中有定義:
<remove name="WebServiceHandlerFactory-Integrated" />
<add name="HTML" path="*.html" verb="*"
type="System.Web.UI.PageHandlerFactory"
resourceType="File" preCondition="integratedMode" />
我懷疑我需要調用除了PageHandlerFactory或者可能的問題是完全不同的東西別的東西。
更新:我的開發環境正在使用集成管道模式,但我需要檢查我的生產環境是否支持它。
你在IIS7 +集成管道模式下運行嗎? –