I'm trying to execute my own route, so I can specify the URL in my application with the selected line, and based on this, do some processing. The problem I am facing is that the created action links are not contextualized based on the URL at which it exists.
Routes
routes.MapRoute(
"TestRoute",
"TEST/{controller}/{action}/{id}",
new { controller = "Space", action = "Index", id = UrlParameter.Optional });
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Space", action = "Index", id = UrlParameter.Optional });
Working with TEST / Space / Index works, as well as Space / Index, but the odd problem I need to fix is ββthat the links created through ActionLink do not obey the context in which they are loaded, at least for {controller } / {action} / {id} by default. Pages that load according to the TEST / Space / Index lists are correct, but when / Space / Index loads, they all link to TEST / route, which the calling URL does not have. Is this the default behavior? Is there a way to get these links to generate in the appropriate context?
Edit:
The first thing I saw was in Html.BeginForm without TEST /
Html.BeginForm("ToTheMoon", "Space", FormMethod.Post)
which displays the link as TEST / Space / ToTheMoon
but it also appears in the links:
@Html.ActionLink("Take Me To The Space Port", "SpacePort", "Space")
which displays TEST / Space / SpacePort