0

MVC3には、デフォルトルートを持つテストと呼ばれる領域があります

        context.MapRoute(
            "test_default",
            "test/{controller}/{action}/{id}",
            new {controller="Store", action = "Index", id = UrlParameter.Optional },
            new string[] { "foo.test.Controllers" }
        );

@Html.ActionLink("Retour au magasin", "index", "Store") は localhost:1111/test を生成します

インデックス ページには、フォルダー test/views/shared にある部分的なビューがありますが、フォルダーが見つからないため、レンダリングされません。

リンクhttp://localhost:1111/test/store/indexはうまく機能します。http://localhost:1111/test の部分ビューを見つけてレンダリングするにはどうすればよいですか? または、アクションリンクによって生成されたリンクhttp://localhost:1111/test/Store/indexを取得するにはどうすればよいですか?

ありがとう

4

1 に答える 1

0

名前空間の引数を .xml 以外のものに変更しているようですArea。テスト エリアがある場合、ルートは次のようになります。

    context.MapRoute(
        "test_default",
        "test/{controller}/{action}/{id}",
        new {controller="Store", action = "Index", id = UrlParameter.Optional },
        new string[] { "MyWebProject.Areas.Test.Controllers" }
    );
于 2011-06-06T14:16:23.123 に答える