0

I have an action I made myself in the controller which returns all blogs of a certain category

[Route("Blog/CategoryBlogs/{id}")]
public ActionResult CategoryBlogs(string id)
{ 
    CategoryOperations co = new CategoryOperations();
    category c = co.GetCategory(id);

    return View(db.blogs.Where(x => x.categoryId == c.Id).ToList());
}

I try to pass the parameter from my index page like this

<a href='@Url.Action("CategoryBlogs","Blog",new { id = "MVC.Net" })'>MVC.Net</a>

However I Always get HTTP Error 404.0 - Not Found. Somehow when I write link without the parameter it enters the method.

Link Generated: /Blog/CategoryBlogs/MVC.Net

phuzi
  • 12,078
  • 3
  • 26
  • 50
Chanter
  • 99
  • 1
  • 12

0 Answers0