diff --git a/src/ImageProcessor.Web/Helpers/ProcessQueryStringEventArgs.cs b/src/ImageProcessor.Web/Helpers/ProcessQueryStringEventArgs.cs
index 3bdda5c72..2fb90ebb8 100644
--- a/src/ImageProcessor.Web/Helpers/ProcessQueryStringEventArgs.cs
+++ b/src/ImageProcessor.Web/Helpers/ProcessQueryStringEventArgs.cs
@@ -21,5 +21,10 @@ namespace ImageProcessor.Web.Helpers
/// Gets or sets the querystring.
///
public string Querystring { get; set; }
+
+ ///
+ /// Gets or sets the raw http request url.
+ ///
+ public string RawUrl { get; set; }
}
}
diff --git a/src/ImageProcessor.Web/HttpModules/ImageProcessingModule.cs b/src/ImageProcessor.Web/HttpModules/ImageProcessingModule.cs
index 2b06b2b7c..f53a9ed25 100644
--- a/src/ImageProcessor.Web/HttpModules/ImageProcessingModule.cs
+++ b/src/ImageProcessor.Web/HttpModules/ImageProcessingModule.cs
@@ -346,6 +346,9 @@ namespace ImageProcessor.Web.HttpModules
// Replace any presets in the querystring with the actual value.
queryString = this.ReplacePresetsInQueryString(queryString);
+
+ // Execute the handler which can change the querystring
+ queryString = this.CheckQuerystringHandler( queryString, request.RawUrl );
// If the current service doesn't require a prefix, don't fetch it.
// Let the static file handler take over.
@@ -557,13 +560,26 @@ namespace ImageProcessor.Web.HttpModules
}
}
}
-
+ return queryString;
+ }
+ ///
+ /// Checks if there is a handler that changes the querystring and executes that handler.
+ ///
+ ///
+ /// The query string.
+ ///
+ ///
+ /// The raw request url.
+ ///
+ ///
+ /// The containing the updated querystring.
+ ///
+ private string CheckQuerystringHandler(string queryString, string rawUrl) {
// Fire the process querystring event.
ProcessQuerystringEventHandler handler = OnProcessQuerystring;
- if (handler != null)
- {
- ProcessQueryStringEventArgs args = new ProcessQueryStringEventArgs { Querystring = queryString ?? string.Empty };
- queryString = handler(this, args);
+ if ( handler != null ) {
+ ProcessQueryStringEventArgs args = new ProcessQueryStringEventArgs { Querystring = queryString ?? string.Empty, RawUrl = rawUrl ?? string.Empty };
+ queryString = handler( this, args );
}
return queryString;
diff --git a/src/TestWebsites/MVC/Global.asax.cs b/src/TestWebsites/MVC/Global.asax.cs
index f72024ad9..11a3d306a 100644
--- a/src/TestWebsites/MVC/Global.asax.cs
+++ b/src/TestWebsites/MVC/Global.asax.cs
@@ -32,7 +32,7 @@ namespace Test_Website_NET45
ImageProcessingModule.OnProcessQuerystring += (sender, args) =>
{
- if (!args.Querystring.Contains("watermark"))
+ if (!args.RawUrl.Contains("penguins"))
{
return args.Querystring += "watermark=protected&color=fff&fontsize=36&fontopacity=70textshadow=true&fontfamily=arial";
}