MVC: Conditionally Display View link

Please see my other MVC articles.

Displaying Links Based on IF Logic

This article illustrates how to conditionally display a link within an MVC based on the results of an IF statement.

As you can see in my View’s HTML, I am displaying a “Home” link and then, if the current user is part of the Administrator role, display a link to the “Admin” page, calling the default (Index) function for that controller. If the user’s current identity does not pass the test, nothing occurs.