Skip to content
This repository has been archived by the owner on Jun 16, 2022. It is now read-only.

Commit

Permalink
[BugFix] Changed the force redirect event handler to PostResolveReque…
Browse files Browse the repository at this point in the history
…stCache instead of AcquireRequestState (Simple Redirect doesn't work ([#117](#117))

Fixed #117
  • Loading branch information
kipusoep committed Feb 26, 2016
1 parent fd4c76c commit 588c97d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 12 deletions.
29 changes: 18 additions & 11 deletions Modules/UrlTrackerModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,30 @@ public void Dispose() { }

public void Init(HttpApplication context)
{
context.AcquireRequestState += context_AcquireRequestState;
context.PostResolveRequestCache += Context_PostResolveRequestCache;
context.EndRequest += context_EndRequest;

LoggingHelper.LogInformation("UrlTracker HttpModule | Subscribed to AcquireRequestState and EndRequest events");
}

void Context_PostResolveRequestCache(object sender, EventArgs e)
{
CheckUrlTrackerInstalled();

if (_execute)
UrlTrackerDo("AcquireRequestState", ignoreHttpStatusCode: true);
}
#endregion

void context_AcquireRequestState(object sender, EventArgs e)
void context_EndRequest(object sender, EventArgs e)
{
CheckUrlTrackerInstalled();

if (_execute)
UrlTrackerDo("EndRequest");
}

static void CheckUrlTrackerInstalled()
{
try
{
Expand All @@ -70,15 +86,6 @@ void context_AcquireRequestState(object sender, EventArgs e)
{
_execute = false;
}

if (_execute)
UrlTrackerDo("AcquireRequestState", ignoreHttpStatusCode: true);
}

void context_EndRequest(object sender, EventArgs e)
{
if (_execute)
UrlTrackerDo("EndRequest");
}

static void UrlTrackerDo(string callingEventName, bool ignoreHttpStatusCode = false)
Expand Down
2 changes: 1 addition & 1 deletion Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.10.*")]
[assembly: AssemblyVersion("3.11.*")]

// SQL
[assembly: WebResource("InfoCaster.Umbraco.UrlTracker.SQL.MicrosoftSqlServer.create-table-1.sql", "text/plain")]
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ Set to true to disable tracking not found (404) requests.
Set to false to disable appending a port number to redirect URLs

## Changelog ##
* 3.11 [2016/02/26]
* [BugFix] Changed the force redirect event handler to PostResolveRequestCache instead of AcquireRequestState (Simple Redirect doesn't work ([#117](https://github.com/kipusoep/UrlTracker/issues/117))
* 3.10 [2016/01/04]
* Happy new year! \o/
* [Improvement] Added support for the excellent ([SEO Metadata for Umbraco plug-in by Epiphany](https://our.umbraco.org/projects/backoffice-extensions/seo-metadata-for-umbraco/)) (altering a URL gets tracked)
Expand Down
6 changes: 6 additions & 0 deletions UI/UrlTrackerInfo.aspx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@
</div>
<div class="tab-pane" id="changeLog">
<ul>
<li>
3.11 [2016/02/26]
<ul>
<li>[BugFix] Changed the force redirect event handler to PostResolveRequestCache instead of AcquireRequestState (Simple Redirect doesn't work <a target="_blank" href="https://github.com/kipusoep/UrlTracker/issues/117">#117</a>)</li>
</ul>
</li>
<li>
3.10 [2016/01/04]
<ul>
Expand Down

0 comments on commit 588c97d

Please sign in to comment.