開発マシンとデプロイメントサーバーの間でUrl.RouteUrlからの出力に違いが見られます。Visual Studio 2008を実行していて、展開ボックスはWindows2003Serverです。ルーティングテーブルの.aspx拡張子で実行するようにGlobal.asax.csを構成しました。ただし、「Search-Basic」という名前のルートを使用すると、Url.RouteUrl( "Search-Basic"、new {category = "Test"、searchExpression = "search this"})からの出力がありません。
コードを表示:
<%= Url.RouteUrl("Search-Basic", new {category = "test", searchExpression="search this"}) %>
Global.asax.csコード:
// routes for IIS 6 and version below
routes.MapRoute(
"Search-Basic",
"Search.aspx/Basic/{category}",
new { controller = "Search", action = "Basic", category = "All" }
);
routes.MapRoute(
"Default", // Route name
"{controller}.aspx/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" } // Parameter defaults
);
routes.MapRoute(
"Root",
"",
new { controller = "Home", action = "Index", id = "" }
);
開発ボックスで、期待される出力が得られます:/Search.aspx/Basic/Test?searchExpression=search%20this
ただし、デプロイメントサーバーでは、出力がまったく得られません。おそらく1つの違いは、デプロイメントサーバーの仮想ディレクトリでアプリケーションを実行していることです。http://testmachine.com/sm/testappname/のようになります。ここで、「/ sm」は仮想ディレクトリであり、「/testappname」はアプリケーションを保持する仮想ディレクトリです。
何か案は?
よろしくお願いします。