@@ -252,25 +252,25 @@ public static void AddCorsRequestHeaders(HttpContext context)
252
252
/// <summary>
253
253
/// Initializes a module and prepares it to handle requests.
254
254
/// </summary>
255
- /// <param name="context ">
255
+ /// <param name="application ">
256
256
/// An <see cref="T:System.Web.HttpApplication"/> that provides
257
257
/// access to the methods, properties, and events common to all
258
258
/// application objects within an ASP.NET application
259
259
/// </param>
260
- public void Init ( HttpApplication context )
260
+ public void Init ( HttpApplication application )
261
261
{
262
262
if ( preserveExifMetaData == null )
263
263
{
264
264
preserveExifMetaData = ImageProcessorConfiguration . Instance . PreserveExifMetaData ;
265
265
}
266
266
267
267
EventHandlerTaskAsyncHelper postAuthorizeHelper = new EventHandlerTaskAsyncHelper ( this . PostAuthorizeRequest ) ;
268
- context . AddOnPostAuthorizeRequestAsync ( postAuthorizeHelper . BeginEventHandler , postAuthorizeHelper . EndEventHandler ) ;
268
+ application . AddOnPostAuthorizeRequestAsync ( postAuthorizeHelper . BeginEventHandler , postAuthorizeHelper . EndEventHandler ) ;
269
269
270
- context . PostReleaseRequestState += this . PostReleaseRequestState ;
270
+ application . PostReleaseRequestState += this . PostReleaseRequestState ;
271
271
272
272
EventHandlerTaskAsyncHelper postProcessHelper = new EventHandlerTaskAsyncHelper ( this . PostProcessImage ) ;
273
- context . AddOnEndRequestAsync ( postProcessHelper . BeginEventHandler , postProcessHelper . EndEventHandler ) ;
273
+ application . AddOnEndRequestAsync ( postProcessHelper . BeginEventHandler , postProcessHelper . EndEventHandler ) ;
274
274
}
275
275
276
276
/// <summary>
@@ -360,7 +360,14 @@ private async Task PostProcessImage(object sender, EventArgs e)
360
360
if ( handler != null )
361
361
{
362
362
context . Items [ CachedPathKey ] = null ;
363
- await Task . Run ( ( ) => handler ( this , new PostProcessingEventArgs { CachedImagePath = cachedPath } ) ) ;
363
+ await Task . Run (
364
+ ( ) => handler (
365
+ this ,
366
+ new PostProcessingEventArgs
367
+ {
368
+ Context = context ,
369
+ CachedImagePath = cachedPath
370
+ } ) ) ;
364
371
}
365
372
}
366
373
@@ -483,7 +490,7 @@ private async Task ProcessImageAsync(HttpContext context)
483
490
queryString = this . ReplacePresetsInQueryString ( queryString ) ;
484
491
485
492
// Execute the handler which can change the querystring
486
- queryString = this . CheckQuerystringHandler ( queryString , request . Unvalidated . RawUrl ) ;
493
+ queryString = this . CheckQuerystringHandler ( context , queryString , request . Unvalidated . RawUrl ) ;
487
494
488
495
if ( string . IsNullOrWhiteSpace ( requestPath ) )
489
496
{
@@ -634,22 +641,24 @@ private string ReplacePresetsInQueryString(string queryString)
634
641
/// <summary>
635
642
/// Checks if there is a handler that changes the querystring and executes that handler.
636
643
/// </summary>
637
- /// <param name="queryString">
638
- /// The query string.
639
- /// </param>
640
- /// <param name="rawUrl">
641
- /// The raw request url.
642
- /// </param>
644
+ /// <param name="context">The current request context.</param>
645
+ /// <param name="queryString">The query string.</param>
646
+ /// <param name="rawUrl">The raw request url.</param>
643
647
/// <returns>
644
648
/// The <see cref="string"/> containing the updated querystring.
645
649
/// </returns>
646
- private string CheckQuerystringHandler ( string queryString , string rawUrl )
650
+ private string CheckQuerystringHandler ( HttpContext context , string queryString , string rawUrl )
647
651
{
648
652
// Fire the process querystring event.
649
653
ProcessQuerystringEventHandler handler = OnProcessQuerystring ;
650
654
if ( handler != null )
651
655
{
652
- ProcessQueryStringEventArgs args = new ProcessQueryStringEventArgs { Querystring = queryString ?? string . Empty , RawUrl = rawUrl ?? string . Empty } ;
656
+ ProcessQueryStringEventArgs args = new ProcessQueryStringEventArgs
657
+ {
658
+ Context = context ,
659
+ Querystring = queryString ?? string . Empty ,
660
+ RawUrl = rawUrl ?? string . Empty
661
+ } ;
653
662
queryString = handler ( this , args ) ;
654
663
}
655
664
0 commit comments