title: How can i create a breadcrumb in MVC4
body: <p>How can I create a breadcrumb in MVC4 without using the MVCsitemapprovider package. By only using web.sitemap nodes. </p>
  
  <p>I have already tried this method and I want to use a sitemap to get the parent node child node and display out.</p>
  
  <pre class="lang-jave prettyprint-override"><code>public static class BreadCrumbHelpers
  {
  
      static StringBuilder breadcrumb = new StringBuilder();
  
      public static string BuildBreadcrumbNavigation(this HtmlHelper helper)
      {
  
         //remove breadcrumb on login page
         //if (helper.ViewContext.RouteData.Values["action"].ToString() == "Index" ||
         //    helper.ViewContext.RouteData.Values["controller"].ToString() == "Account")
         //{
         //    return string.Empty;
         //}
  
    //Area root
          if (helper.ViewContext.RouteData.DataTokens["area"] == "Admin")
          {
  
              MenuIndexStringBuilder(helper);
              //Return to previous breadcrumb
              if (helper.ViewContext.RouteData.Values["action"].ToString() == "Page2")
              {
                  breadcrumb.Append("&lt;li&gt;" + helper.ActionLink("Page 1", "Page1", "Testing") + "&lt;/li&gt;");
              }
          }       
          else if (helper.ViewContext.RouteData.DataTokens["area"] == "Student")
          {
  
              MenuIndexStringBuilder(helper);
              //Return to previous breadcrumb
              if (helper.ViewContext.RouteData.Values["action"].ToString() == "Page2")
              {
                  breadcrumb.Append("&lt;li&gt;" + helper.ActionLink("Page 1", "Page1", "SPageTest") + "&lt;/li&gt;");
              }
          }
          else
          {
              //Default page
              breadcrumb = new StringBuilder("&lt;ul class=\"breadcrumb\"&gt;&lt;li&gt;")
                  .Append(helper.ActionLink("Menu", "Index", "Template").ToHtmlString())
                  .Append("&lt;/li&gt;");
  
              //Return to previous breadcrumb
          }
          if (helper.ViewContext.RouteData.Values["action"].ToString() != "Index")
  
          {  
              BreadcrumbAppend(helper);
          }
  
          return breadcrumb.Append("&lt;/ul&gt;").ToString();
      }
  
      private static void MenuIndexStringBuilder(this HtmlHelper helper)
      {
          breadcrumb = new StringBuilder("&lt;ul class=\"breadcrumb\"&gt;&lt;li&gt;")
                    .Append(helper.ActionLink("Menu", "Index", "Template", new { area = "" }, null).ToHtmlString())
                    .Append("&lt;/li&gt;");
  
      }
      private static void BreadcrumbAppend(this HtmlHelper helper)
      {
          breadcrumb.Append("&lt;li&gt;");
          breadcrumb.Append(helper.ActionLink(helper.ViewContext.RouteData.Values["action"].ToString().Titleize(),
                                              helper.ViewContext.RouteData.Values["action"].ToString(),
                                              helper.ViewContext.RouteData.Values["controller"].ToString()));
          breadcrumb.Append("&lt;/li&gt;");
  
      }
  
  }
  </code></pre>