I want to change url in my page with the correct url after request in the controller by the attribute routing. How can i do please ?
By exemple, i have a correct url in the map route : localhost/blog/5/nameblog if i tape : localhost/blog/5/blabla, i want to diplay and rename in the correct url localhost/blog/5/nameblog once the blog id and his name have been found in database with id 5 :
[Route("{blog}/{Idblog}/{nameblog}")]
public ActionResult GetBlogById(int Idblog)
{
// search the name blog with ID in database
.....
return View() // i want to display the correct url after the request
}
Thank you for your help !