private static bool PermissionDenied(MediaRequestHandlerArgs handlerArgs) { using (new SecurityDisabler()) { handlerArgs.Media = MediaManager.GetMedia(handlerArgs.Request.MediaUri); } return(handlerArgs.Media != null); }
protected override bool DoProcessRequest(HttpContext context) { var mediaRequestHandlerArgs = new MediaRequestHandlerArgs(context); CorePipeline.Run("mediaRequestHandler", mediaRequestHandlerArgs, failIfNotExists: false); if (mediaRequestHandlerArgs.Aborted) { return(mediaRequestHandlerArgs.Result); } return(new MediaRequestHandler().DoProcessRequest(mediaRequestHandlerArgs.Context, mediaRequestHandlerArgs.Request, mediaRequestHandlerArgs.Media)); }
protected override bool DoProcessRequest(HttpContext context) { var mediaRequestHandlerArgs = new MediaRequestHandlerArgs(context); CorePipeline.Run("mediaRequestHandler", mediaRequestHandlerArgs, failIfNotExists: false); if (mediaRequestHandlerArgs.Aborted) { return(mediaRequestHandlerArgs.Result); } if (context?.Request.QueryString?["extension"] == "webp" || (!Helpers.CdnEnabled && context.BrowserSupportsWebP())) { mediaRequestHandlerArgs.Request.Options.CustomOptions["extension"] = "webp"; } return(DoProcessRequest(mediaRequestHandlerArgs.Context, mediaRequestHandlerArgs.Request, mediaRequestHandlerArgs.Media)); }
public override void Process(MediaRequestHandlerArgs handlerArgs) { if (handlerArgs.Media != null) { return; } var notFoundUrl = GetNotFoundUrl(); if (string.IsNullOrWhiteSpace(notFoundUrl)) { return; } var httpServer = _httpServerThunk(); httpServer.TransferRequest(notFoundUrl); handlerArgs.Result = true; handlerArgs.AbortPipeline(); }
public override void Process(MediaRequestHandlerArgs handlerArgs) { if (handlerArgs.Media != null) { return; } if (!PermissionDenied(handlerArgs)) { return; } var loginUrl = GetLoginUrl(); if (string.IsNullOrWhiteSpace(loginUrl)) { return; } var httpResponse = _httpResponseThunk(); httpResponse.Redirect(loginUrl); handlerArgs.Result = true; handlerArgs.AbortPipeline(); }