What is the difference [email protected] vs 'Asp-controller' next to 'Asp-action'?

Asked

Viewed 113 times

0

I am doing a project in ASP.NET MVC and I came up with this question, The Url.Action in a 'tag' (for example in a navbar) can redirect the page passing the method and controller as parameter. However there are the attributes Asp-controller (define the controller) and Asp-action (define the method) that would bring the same result, this is possible?

 <ul class="ulMenu">
    <li class="liMenu"><a asp-controller="Home" asp-action="Index">Home</a></li>

    <li class="liMenu"><a href='@Url.Action("Index", "Home")'>Home</a></li>
 </ul>

1 answer

0


In practice there is no difference, the output generated will be the same. What changes is that anchor tag helper is more semantic with html, it’s like you write pure html to mount your html tags

Browser other questions tagged

You are not signed in. Login or sign up in order to post.