I have a controller which should only request authorization when loaded with specific parameters. Like when the parameter ID is 8 for example.
I came up with using a
protected override bool AuthorizeCore(HttpContextBase httpContext)
{
var rd = httpContext.Request.RequestContext.RouteData;
string currentAction = rd.GetRequiredString("action");
string actionparam =Convert.ToString(rd.Values["param"]);
if (id == actionparam)
{
return base.AuthorizeCore(httpContext);
}
return true;
}