MVC プロジェクトに取り組んでおり、URL の再ルーティングに苦労しています。私が現在持っているのは
http://dev.mywebsite.com/s/index?Key=abc123
次に、インデックスアクションを実行し、希望どおりに完了します。入力できるようにしたいです
http://dev.mywebsite.com/s/abc123
通常どおりインデックスアクションを実行します
私は現在持っています
routes.MapRoute(null, "s/index/{id}", new
{
controller = "Home",
action = "Index",
id = UrlParameter.Optional
}
);
しかし、私はここからどこへ行くべきかについてちょっと立ち往生しています。どんな援助でも大歓迎です。ありがとう
編集: 私の完全な routeconfig クラス
routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.IgnoreRoute("sites/{*pathInfo}");
routes.MapRoute(null, "s/index/{key}", new
{
controller = "S",
action = "Index",
key = UrlParameter.Optional
}
);
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Site", action = "Index", id = UrlParameter.Optional },
new[] { "Custom.Web.Controllers" }
);
}
私のコントローラーには、actionresult インデックスがあります。
public ActionResult Index(string Key)
{
return Redirect(workflow.RetrieveURL(Key));
}