asp.net mvc - SQL server error when creating an ActionLink visible to certain roles -


What do I want to do, only to show the ActionLink in my page for some roles (in this case the "Administrator" role ).

When I add this code to my layout page ...

  @if (Request.IsAuthenticated) {if (HttpContext.Current.User.IsInRole ("Admin ")) {& Lt; Li & gt; @html.exelink ("select roles", "index", "selectionrolls") & lt; / Li & gt; }}  

The following SQL Server error appears:

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 example name is correct and SQL Server is configured to allow remote connection. (Provider: SQL Network Interfaces, Error: 26 - Error specifying server / instance)

What is the problem? I have seen that I can not use classes such as membership, roles or attributes because this issue is officially seen.

This is a pure SQL connection error, this error has nothing to do with any role. As an example, check that there are more than one connection string in your solution, it can be an explanation how your connection sometimes and sometimes works.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -