私は次のようなアクションを持っています
public class EmployerController : Controller
{
public ActionResult Message(string contractorId, int projectId)
{....}
および @html.ActionLink として
@Html.ActionLink("Message", "Message", "Employer", new { contractorId = @model.ContractorId, projectId = @model.ProjectId }, null)
私は次のようなURLになります
http://localhost:3597/Employer/Message?contractorId=contractor&projectId=10
一方、次のようなURLが必要です
http://localhost:3597/Employer/Message/contractor/10
私のRouteConfig.csに、追加しました
routes.MapRoute(
name: "MessageRoute",
url: "Employer/Message/{contractorId}/{projectId}",
defaults: new { controller = "Employer", action = "Message", contractorId = (string)null, projectId = 0 }
);
何が欠けていますか。ルートでクエリ文字列を無効にする方法は?
/ありがとう。