I have created two classes that implement AuthorizeAttribute.
One is used globally, and I set it on the Global.asax.cs:
filters.Add(new FirstAuthorizeAttribute() { Order = 0 });
The other is called SecondAuthorizeAttribute and it is used only in some action methods, and I use it as attribute in the methods I want.
[HttpGet]
[SecondAuthorize]
public ActionResult LogOut()
{
FormsAuthentication.SignOut();
Session.Clear();
Session.Abandon();
return Redirect(Url.Content("~/"));
}
The problem is that SecondAuthorizeAttribute always execute before FirstAuthorizeAttribute, and I need this one to execute first. The order is not being helpful, how could I do it?
This is a long shot, but have you tried using the Global and First values for your FirstAuthorizeAttribute ?
http://msdn.microsoft.com/en-us/library/system.web.mvc.filterscope(v=vs.98).aspx
http://blog.rajsoftware.com/post/2011/05/14/MVC3-Filter-Ordering.aspx