I have a question about Url.Action.
My position is on http://localhost/User/Edit and for some case I have to generate a link with a javascript function, so it would be like this:
return '<a href="@Url.Action("Group","Edit")/' +myParameterInJavascript +'>link</a>';
If I look to the link, it would be ok, I got: http://localhost/Group/Edit/ParameterFromJs
But, then when my current position is http://localhost/Group/Edit/ParameterFromJs
and I generate the same link again, the URL will become :
http://localhost/Group/Edit/ParameterFromJs/ParameterFromJs
Why don’t I just get the url http://localhost/Group/Edit/ParameterFromJs?
Why was my action Edit/ParameterFromJs, and not just Edit?
Can you give me some hint or tips? Thanks in advance
UPDATE :
This is my routing:
routes.MapRoute("group-edit",
"Group/Edit/{groupName}",
new
{
controller = "Group",
action = "Edit"
}
);
Try using routing: