When I Use :
[Authorize]
public ActionResult Index() {
....
return View();
}
OR
[Authorize(Users="john")]
public ActionResult Index() {
....
return View();
}
My Script Working Well But When I Use :
[Authorize(Roles="Admin")]
public ActionResult Index() {
.....
return View();
}
Error:
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).
I found a solution. In my web.config:
I added the line 3, and the new AspNet.Identity code took over allowing me to use
User.IsInRole(..)