Q:

Implementing a blog entry link

I am developing an application like a blog engine.  On a view for a home page, I have a link as
<a href="/Blog/BlogEntry/2013/05/22/title for this blog entry" />

when user click on that link it will come to a Blog controller and run a BlogEntry action there
public class BlogController : Controller {
   public ActionResult BlogEntry(string title, DateTime createdDate) {
       // doing something
       var viewModel = something here for build the view model

       return View(viewModel);
   }
}

The question is how can I do that? 

A:

Do like this , as all the parameter will map from URL.  Use the action filter to map the data the way you want.  I am not completely tested the code , but it will give  the fare idea.  Add this attribute above your action. 
   public ActionResult BlogEntry(int year, int month , int day , string title)

    using System;
    using System. Collections. Generic;
    using System. Linq;
    using System. Web;
     using System. Web. Mvc;

    namespace OurAttributes
    {
     public class PopulateTitleDandDateAttribute : ActionFilterAttribute
     {
    public override void OnActionExecuting(ActionExecutingContext filterContext)
    {

                string[] url = filterContext. HttpContext. Request. Uri.split('/');
                DateTime d = new Date(url[2],url[3],url[4]);
                if (filterContext. ActionParameters. ContainsKey("createdDate"))
                {
                    filterContext. ActionParameters["createdDate"] = d;
                }

                if (filterContext. ActionParameters. ContainsKey("title"))
                {
                    filterContext. ActionParameters["title"] = url[5] ;
                }
                base. OnActionExecuting(filterContext);

    }
  }
 }

