Page redirect issue on route

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: Step_01 and Step_06.

This is the call in the Index of Step_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 Step_06, and it redirects me to Step_01. If you comment on the routes, it works. What else should I do?

    
asked by anonymous 18.03.2014 / 18:04

1 answer

1

You can use UrlHelper to help create urls in your view:

Url.Action("Passo_06", "Passo")

Exemplifying usage:

<button
    id="btnGravarPassageiros"
    onclick="window.location.href='@Url.Action("Passo_06", "Passo")'"
    value="novaPesquisa" class="btn-pular-passo pull-right">Ir para o passo 06</button>
    
18.03.2014 / 18:22