I have a action like
public class EmployerController : Controller
{
public ActionResult Message(string contractorId, int projectId)
{....}
and a @html.ActionLink as
@Html.ActionLink("Message", "Message", "Employer", new { contractorId = @model.ContractorId, projectId = @model.ProjectId }, null)
I end up with urls like
http://localhost:3597/Employer/Message?contractorId=contractor&projectId=10
whereas I want urls like
http://localhost:3597/Employer/Message/contractor/10
In my RouteConfig.cs, I have added
routes.MapRoute(
name: "MessageRoute",
url: "Employer/Message/{contractorId}/{projectId}",
defaults: new { controller = "Employer", action = "Message", contractorId = (string)null, projectId = 0 }
);
What am I missing. How to disable querystring in routes?
/thanks.