The media library images in our solution are protected by a custom override on the Sitecore
MediaRequestHandler. This, in turn, checks against some Sitecore configuration item whether or not a user is permitted to access this media item or
If a user tries to access the media item directly by URL in a new session, the
MediaRequestHandler checks if a user is permitted to access the media item before our (custom, not Sitecore based) autologin system in
Global.asax.cs in Session_Start has the chance to auto-login the user. Of course, once the user tries to access the media item again, everything works as expected, because then the session is already established.
Is there a way to change the order of the media request handler so that it only fires after