I have a route like this:
routes.MapRoute(
name: "RotaConteudo",
url: "Conteudo/{name}/{Parametro}/{tipo}",
defaults: new { controller = "Conteudo", action = "Conteudo", name = "", Parametro = "", tipo = "" }
);
When the page loads, my url looks like this.
..../Conteudo/argentina/3/3
The 3/3
are the respective parameters passed in the route. Can you hide them in the URL?
I have a foreach (in the home) that mounts my URL, like this:
foreach (var item3 in item2.subconsulta2)
{
if (item3.Id_SubCategoria2 != null)
str = str + "<li><a href=\"/Conteudo/" + item3.Id_SubCategoria2 + "/3/" + retira_acentos(item3.SubCategoria2).ToLower().Replace(" ", "-") + "\" title=\"\">" + item3.SubCategoria2 + "</a></li>";
else
str = str + "<li><a>" + item3.SubCategoria2 + "</a></li>";
}
It sends these parameters to a method I have in a controller and it goes into the database and takes the HTML corresponding to that parameter. If I could pass the parameter, other than the URL, I would refer to Route, to display only the name, since the HTML will be shown by the parameter passed in another way.