GleDel
GleDel

Reputation: 471

@html.actionlink renders wrong url

I've just started to learn ASP.NET and I'm trying to create a simple navigation but somohow i get the wrong url. I've been looking for anwsers all over the place but most are about more complex url.

I'm using this for my navigation

<nav>
        <ul>
            <li>@Html.ActionLink("Home", "index")</li>
            <li>@Html.ActionLink("Domeinen", "Domain")</li>
        </ul>
    </nav>

The website renders but when I click "domeinen" It brings me to

http://localhost:7498/Home/Domain

instead of

http://localhost:7498/Domain

Can anyone point me in the right direction?

Upvotes: 0

Views: 142

Answers (1)

Joanvo
Joanvo

Reputation: 5817

By default, it creates a url to the current controller (which is Home in your case). If you want to modify it, you can use another of this function signatures:

Html.ActionLink("Domeinen", "Domain", "DomainController")

Upvotes: 1

Related Questions