1

.NET3.5FrameworkでMVC1.0を使用しています。URLをwww.example.com/{controller}/{action}/{id}ではなくwww.example.comとして表示したいクライアントがいます。

  1. サイトがホストされているサーバーはIIS6を利用しています。
  2. このサーバーに直接アクセスできません。

それを念頭に置いて、これを行うことができますか?

誰かがISAPI_REWRITEの使用を提案しました。私はいくつかの例を見つけましたが、実際に何をする必要があるかを正しく説明しているものはありません。

または、これをサイト全体で実行できない場合。ホームページだけでできますか?

以下は、現時点での私のルーティングです。

public static void RegisterRoutes(RouteCollection routes)
{
     routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
     // Catch all route
     routes.MapRoute(
     "Default", // Name
     "{lang}/{controller}" + System.Configuration.ConfigurationManager.AppSettings["extension"] + "/{action}/{*values}",  // URL - ["extension"] being .aspx for IIS 6
     new { lang = "EN", controller = "Content", action = "Index" } // Defaults);
 }

前もって感謝します。

4

1 に答える 1

1

あなたは書くべきです

public static void RegisterRoutes(RouteCollection routes)
{
     routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

  routes.MapRoute(
         "HomeIndex", // Name
         "",
         new { lang = "EN", controller = "Home", action = "Index" } // Defaults);


     // Catch all route
     routes.MapRoute(
     "Default", // Name
     "{lang}/{controller}" + System.Configuration.ConfigurationManager.AppSettings["extension"] + "/{action}/{*values}",  // URL - ["extension"] being .aspx for IIS 6
     new { lang = "EN", controller = "Content", action = "Index" } // Defaults);
 }
于 2012-09-19T13:33:19.420 に答える