TValerii
TValerii

Reputation: 180

Filters in ASP.NET - How to differentiate Document requests from other requests

I need a way to differentiate Document requests (that return actual DOM - the very first request when you visit a page), from all other requests i.e ajax, controller actions, etc.

Based on MS Docs, Authorization is hit first in the pipeline. So i want to implement a filter:

public void OnAuthorization(AuthorizationContext filterContext) 
{
// check if this is a DOM request, and do something
}

I want this check to be particularly in Authorization filter because it's the first in the pipe, and it would be most efficient to do the thing before all other filters execute.

I checked all the details in filterContext and couldn't find anything i can rely on. If it's not possible in Authorization filter, i am curious about how it can be solved in other filters.

Upvotes: 0

Views: 171

Answers (0)

Related Questions