0
目前我有這個如何重定向子文件夾中的所有文件訪問請求?
routes.MapRoute(
name: "TestRedirect",
url: "Test/{*pathInfo}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
我希望所有的請求下,測試訪問重定向到〜/首頁/索引。 但不幸的是,這不適用於文件訪問,如/Test/index.html。 雖然只有aspx文件(如/Test/index.aspx)被正確重定向。
有人可以幫我修理我的路由嗎?
非常感謝。
你想利用PATHINFO的或忽略它,使用/ Home/Index? – 2013-03-01 20:34:35
@DaveA其實我不需要使用它。我只是抓住它像通配符或其他東西一樣工作。 – ailerifren 2013-03-01 20:39:24