Barka
Barka

Reputation: 8932

ActionLink does not create the right link

This is super straight forward, but somehow it is not working. Can you please take a look?

on my page I have:

<%= Html.ActionLink("My Recipes", "Index", "Recipes")%>

and i have the following controller:

namespace MyWebSite.Controllers
{
    public class RecipesController : Controller
    {
        //
        // GET: /Recipes/

        public ActionResult Index()
        {
            return View();
        }

the html that is generated is:

<a href="">My Recipes</a>

while I expect it to be:

<a href="/Recipes/Index">My Recipes</a>

My controller is named: RecipesController.cs and is in the Controllers folder with all my other controllers?

Whats wrong?

Many thanks!

Upvotes: 0

Views: 50

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1039418

You seem to have messed up with your routes.

Upvotes: 1

Related Questions