I have an action method and posting to it using ajax like this:
$.ajax({
url: \"/GetSearchCriteria\",
type: \"GET\",
Add AttributeUsage to your class:
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class,
AllowMultiple = false, Inherited = true)]
public class AjaxAuthorizeAttribute : AuthorizeAttribute { ... }
Please make sure you don't have a regular [Authorize]
attribute on the Controller
level.
Because if so, your custom [AjaxAuthorize]
won't be hit.