Url ( ROUTE) with NAMES and not ID

Asked

Viewed 100 times

1

How can I dynamically change a URL in a BD search of Id’s by NAME to become a friendlier URL (SEO).

My URL today:

http://meusistema.com.br/Achei/26/8717/1/2/3 - being the 26=STATE, 8717=CITY,1=NEIGHBORHOOD, 2=CATEGORY, 3=BUSINESS

The URL I think is best for viewing:

http://meusistema.com.br/Achei/sao-paulo/sao-paulo/morumbi/casa/venda

The route on the Routes.Mappageroute is thus:

routes.MapPageRoute(
            "AcheiCatNegRoute",
            "Achei/{idestado}/{idcidade}/{idbairro}/{idcategoria}/{idnegocio}",
            "~/Achei.aspx"

I think there should be a way for the URL to assume the name is not the ID without having to change the logic of the database, I believe that to search for the ID is faster than for a String, I appreciate any help.

Note: I also use Webforms with Asp.NET and SQL.

  • as you will be passing a String in Routedata, then you will need to do your SQL search using strings, what can be done to ease your situation is to add an Input to the affected columns.

  • Are you using MVC? Can you describe how Binding of parameters between the layer processing the request and the route?

  • Like it’s done in Controller?

  • Paulo is not MVC is Webforms

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.