I have an “age gate” filter in my Controller (all controllers extend from it). It simply checks if a user has a “I’m old enough” cookie and - if he doesn’t - redirects him to a “what’s you birthday” page. It works all right with one exception - nonexistent files. For example, if I don’t have a robots.txt file and it’s requested, the filter kicks in (and I don’t want it to be).
The solution would be to skip running this filter for 404 pages or check if it’s 404 within the filter and return true if that’s the case. How to I accomplish either of them?
Thank you. I ended up modifying .htaccess to not route anything “with an extension” through the app. By default, if for example robots.txt doesn’t exist, the app attemts (unsuccessfully) to route it to a controller/action and displays 404.