asp.net core id value in route doesn't work with ajax
问题 I am making something like a chat room application, and when you enter a chat room I use the room id to assign messages to that room, I am using Ajax to send and retrieve messages. Map Route: config.MapRoute( name: "Default", template: "{controller}/{action}/{id?}", defaults: new { controller = "Room", action = "Index" }); Navigation to room: <a class="btn btn-default" asp-controller="Chat" asp-action="Index" asp-route-id="@room.Id">@room.Name</a> So when you are in a room the Route is like