What I want to do is to make an ActionLink visible in my page only to certain roles(in this case the "Admin" role).
When I add this code to my Layout page...
@if (Request.IsAuthenticated)
{
if (HttpContext.Current.User.IsInRole("Admin"))
{
<li>@Html.ActionLink("Select Roles", "Index", "SelectRoles")</li>
}
}
The following SQL Server error shows up:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
What seems to be the problem? I observed that I cannot use classes like Membership, Roles or attributes like Authorize because the same problem appears .