0

I pull the tags in the news details section. The corresponding code block is below.

NewsDetail: 
    foreach (var item in etiketler.Take(1))
                                    {
                                        <span><a href="@Url.Action("Tag", "Page", new { tag = @item })">@item</a></span>
                                    }
                                    foreach (var item in etiketler.Skip(1))
                                    {
                                        <span><a href="@Url.Action("Tag", "Page", new { tag = @item })">@item</a></span>
                                }


Controller :
   public ActionResult Tag(string tag, int? pageSize)
        {
            string id = this.RouteData.Values["tag"].ToString();
           
            SectionServices _sectionServices = new SectionServices();

          
            if (!pageSize.HasValue) pageSize = 1;
            ViewBag.Current = pageSize;
            Models.TagModel model = new Models.TagModel();
            var dat = _sectionServices.getNewsByTag((int)pageSize, tag);

         
            ViewData["etiket"] = tag;
            if (dat != null)
            {
                ViewBag.Tag = tag;
                model.getNews = dat;
                return View(model);
            }
            return View();
        }

Route Config : 
   routes.MapRoute(
               name: "TagPage",
               url: "{tag}-haberleri/{pageSize}",
               defaults: new { controller = "Page", action = "Tag", pageSize = UrlParameter.Optional }
           );

I get errors like "The controller for path '/Mert Hakan_haberleri / 2' was not found or does not implement IController" in log records. what is the cause of this error, clicking on tags works correctly, but I see this error in log records.

1 Answers1

0

I also had this error. When I embedded the classes into a namespace, everything started working for me.

 namespace PageControllers { // added this line!
      public class PageController {
        public ActionResult Tag() {
          //code logic
          return View();
        }
      }
    }
Jimesh
  • 479
  • 5
  • 17