Tag Archives: asp.net

ASP.NET MVC exception : Multiple types were found that match the controller named ‘Home’

This error message often happens when you use areas and you have the same controller name inside the area and the root. For example you have the two:


In order to resolve this issue (as the error message suggests you), you could use namespaces when declaring your routes. So in the main route definition in Global.asax:

    new { controller = "Home", action = "Index", id = UrlParameter.Optional },
    new[] { "AppName.Controllers" }

and in your ~/Areas/Admin/AdminAreaRegistration.cs:

    new { action = "Index", id = UrlParameter.Optional },
    new[] { "AppName.Areas.Admin.Controllers" }

If you are not using areas it seems that your both applications are hosted inside the same ASP.NET application and conflicts occur because you have the same controllers defined in different namespaces. You will have to configure IIS to host those two as separate ASP.NET applications if you want to avoid such kind of conflicts. Ask your hosting provider for this if you don’t have access to the server.

References :

Generate Nested Menu from datatable using c# as ul list

public JsonResult GetCategories()
            nDownloadEntities entities = new nDownloadEntities();
            List<Category> categories = entities.Categories.ToList();

            var sb = new StringBuilder();

            var roots = GetRoots(categories);
            string unorderedList = GenerateUL(roots, categories, sb);

            return Json(unorderedList, JsonRequestBehavior.AllowGet);

        private List<Category> GetRoots(List<Category> categories)
            var roots = categories.Where(x => x.ParentId == 0).ToList();
            return roots;

        private string GenerateUL(List<Category> parents, List<Category> categories, StringBuilder sb)

            if (parents.Count > 0)
                foreach (Category category in parents)
                    string line = String.Format(@"<li>{0}", category.CategoryText);

                    List<Category> subMenu=categories.Where(x=>x.ParentId==category.CategoryId).ToList();
                    if (subMenu.Any())
                        var subMenuBuilder = new StringBuilder();
                        sb.Append(GenerateUL(subMenu, categories, subMenuBuilder));

            return sb.ToString();

References :

Keywords :

ul , li , treeview , menu , recursive

How to add JavaScript library in MVC project

JavaScript :

bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(


bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(

References :

Keywords : 

References ,  Script , Bundle