I am trying to use the Authorize
class in my ASP MVC3 app. Unfortunately due to business rules I need to pull the Roles
from our web.config, however this is throwing the following exception:
An attribute must be a constant expression, typeof or array creation expression of an attribute parameter type
Here is the code I'm referencing.
[Authorize(Roles = ConfigurationManager.AppSettings.Get("user"))]
public class AdminController : Controller
{
Here is the user
section of my web.config
<add key="user" value="SA\\Application.MortalityConcentrationRA.Dev.Users" />