How to change website URLs to be friendly?

0

At this moment I have to implement some SEO improvements in the portal that I developed, among them they ask me to change the URs so that they are more friendly.

Is there any way to do it that does not involve changing all the names to the controllers and methods?

    
asked by Gustavo Rojas 08.04.2016 в 15:04
source

1 answer

2

You could adapt the url of the action using the attribute [Route]

Understanding URL Rewriting and URL Attribute Routing in ASP.NET MVC (MVC5) with Examples

[RoutePrefix("students")]
public class StudentsController : Controller
{
    [Route("college-students")]
    public ActionResult ShowStudents() { ... }
    //resto codigo
    ...
}

As you can see, the name of the action method is different from the url with which you can access and redefine it with the attribute

    
answered by 08.04.2016 / 15:14
source