ASP.Net MVC4 Custom Routing

Holow

New Member
I am currently trying to figure out how to change my blog's url rules and I cannot figure out where to even start. Right now the URLs are /Blog/Details/1 but I think I read somewhere that it is a better SEO practice to make the URL /Blog/Details/Post-Title. I have created an extra field in my blog database labeled FriendlyUrl and when I create a blog entry I replace spaces with dhases (-) but now I have no idea how to make my app work properly. I was told to look to my global.asx.cs but this is what mine looks like.\[code\]public class MvcApplication : HttpApplication{ protected void Application_Start() { AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); AuthConfig.RegisterAuth(); }}\[/code\]Here is my controller code for details\[code\]public ActionResult Details(int id = 0) { Blog blog = _db.Blogs.Find(id); if (blog == null) { return HttpNotFound(); } return View(blog); }\[/code\]and here is the link currently being used to link to a blog entry.\[code\]<a href="http://stackoverflow.com/questions/15593545/@Url.Action("Details", "Blog", new { id=item.Id})">@Html.DisplayFor(modelItem => item.Title)</a>\[/code\]Thanks in advance for any help.
 
Back
Top