1
These are the routes
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Pacotes",
url: "Passo/{name}",
defaults: new { controller = "Passo", action = "Passo_01", name = "" }
);
routes.MapRoute(
name: "RotaConteudo",
url: "Conteudo/{name}/{Parametro}/{tipo}",
defaults: new { controller = "Conteudo", action = "Conteudo", name = "", Parametro = "", tipo = "" }
);
routes.MapRoute(
name: "RotaPasso_6",
url: "Passo/{name}",
defaults: new { controller = "Passo", action = "Passo_6", name = "" }
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
In my controller there are two Actionresult: Passo_01 and Passo_06.
This is the call in the Index of Passo_06
<button id="btnGravarPassageiros" onclick="window.location.href='/Passo/Passo_06'" value="novaPesquisa" class="btn-pular-passo pull-right">Ir para o passo 06</button>
What happens is that I click the button to go to Passo_06, and it redirects me to Passo_01. If I comment on the routes, it works. What else should I do?
Okay, buddy, keep coming to Action Passo_01 and not Passo_06. I did as an example.
– pnet
The problem is in your routes. You are using the same url (
url: "Passo/{name}"
) so much for the actionPasso_01
as for the actionPasso_06
. The url should be different, something likePasso/1/{name}
andPasso/6/{name}
.– Miguel Angelo
Man, thanks a lot. It worked!!! That’s right. But one for "good practices", ehehehehehehehe.
– pnet
You can mark this answer as the solution of the problem then! That way, people will know it’s settled, plus I get a few points. = D
– Miguel Angelo
As I mark an answer?
– pnet
There is a sign below the arrows to vote, like a " ", when you click this " " it will be filled with green.
– Miguel Angelo