3
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 you move up the page, my url looks like this.
..../Conteudo/argentina/3/3
The 3/3
are the respective parameters passed on the route. There is a way to hide them in the URL?
I have a foreach(at home) that mounts my URL, so:
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 that I have in a controller and it goes in the database and takes the HTML corresponding to this parameter. If I could pass the parameter, other than the URL, I would refocus the Route, to display only the name, since the HTML will be shown by the parameter otherwise passed.
I have a foreach(at home) that mounts my URL, like foreach (var item3 in item2.subconsulta2) { if (item3.Id_subcategoria2 != null) str = str + "<li><a href="/Content/" + item3.Id_subcategoria2 + "/3/" + remove_accents(item3.Subcategory2). Tolower(). Replace(" ", "-") + "" title="">" + item3.Subcategory2 + "</a></li>"; Else str = str + "<li><a>" + item3.Subcategory2 + "</a></li>"; }
– pnet
Edit your question and add this information that is in comment, right after you have done this, delete the comment.
– Paulo Roberto Rosa
@pnet: Dude, didn’t you have 160 points? Now you only have 6???
– Miguel Angelo
So, I don’t know what happened. I always posted directly, but this last time, asked me to create a password. I created and asked to create a login. I did it and it worked. Really the site is still a bit confusing. I need to take a tour and understand all this.
– pnet
@pnet: I saw it there in the user list... you ended up creating another user with the same name. Ask there on meta.pt.stackoverflow.com how to solve this problem.
– Miguel Angelo
@pnet See if it helps ==> http://erraticdev.blogspot.com.br/2011/03/removaing-route-values-from-linksurls-in.html
– Hermes Autran
@pnet Have you solved your question? Please give some feedback on this question. ;)
– Miguel Angelo