I have to give access rigths to the users of a website. I am doing the filtering here:
protected override void OnActionExecuting(ActionExecutingContext filterContext)
{
}
The problem is that I cannot distinguish full View request such as 'Index' from PartialViewRequests or AJAX calls requests.
Therefore the page 'Index'
has access but the 'PartialViewGridViewForIndex'
does not have access.
The property ControllerContext.IsChildAction
does not help either.
You could use the IsAjaxRequest extension method to determine if an AJAX request was used to invoke this controller action:
protected override void OnActionExecuting(ActionExecutingContext filterContext)
{
if (filterContext.HttpContext.Request.IsAjaxRequest())
{
// the controller action was invoked with an AJAX request
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With