I am using ASP.NET MVC for a project. I use a lot of User Control and I need to check the current user and the check if it has the roles etc, now I create the user in every UserControl I see the Permissions. I want to change that so I create it only once.
the Question is Whta is the best aproch? viewData["User"] = user and the get the user form here or what? what do you recomend so I can get rid of this lines
LCP.eTorneos.Dal.EntityFramework.JugadorRepository jugadorRepository =
new LCP.eTorneos.Dal.EntityFramework.JugadorRepository();
var jugador = jugadorRepository.GetJugador(User.Identity.Name)
<% if (Page.User.Identity.IsAuthenticated && jugador.IsAdmin) { %>
...
<%}%>