|
|
|
@ -46,6 +46,34 @@ namespace Teknik
@@ -46,6 +46,34 @@ namespace Teknik
|
|
|
|
|
var stopwatch = new Stopwatch(); |
|
|
|
|
HttpContext.Current.Items["Stopwatch"] = stopwatch; |
|
|
|
|
stopwatch.Start(); |
|
|
|
|
|
|
|
|
|
// Handle Piwik Tracking if enabled
|
|
|
|
|
Config config = Config.Load(); |
|
|
|
|
if (config.PiwikConfig.Enabled) |
|
|
|
|
{ |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
HttpRequest request = base.Request; |
|
|
|
|
|
|
|
|
|
string sub = request.RequestContext.RouteData.Values["sub"].ToString(); |
|
|
|
|
if (string.IsNullOrEmpty(sub)) |
|
|
|
|
{ |
|
|
|
|
sub = request.Url.AbsoluteUri.GetSubdomain(); |
|
|
|
|
} |
|
|
|
|
string title = config.Title; |
|
|
|
|
Page page = HttpContext.Current.Handler as Page; |
|
|
|
|
|
|
|
|
|
if (page != null) |
|
|
|
|
{ |
|
|
|
|
title = page.Title; |
|
|
|
|
} |
|
|
|
|
Tracking.TrackPageView(new HttpRequestWrapper(request), title, sub); |
|
|
|
|
} |
|
|
|
|
catch (Exception ex) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected void Application_EndRequest(object sender, EventArgs e) |
|
|
|
@ -66,33 +94,6 @@ namespace Teknik
@@ -66,33 +94,6 @@ namespace Teknik
|
|
|
|
|
{ |
|
|
|
|
context.Response.AppendHeader("Access-Control-Allow-Origin", origin); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//// Handle Piwik Tracking if enabled
|
|
|
|
|
//Config config = Config.Load();
|
|
|
|
|
//if (config.PiwikConfig.Enabled)
|
|
|
|
|
//{
|
|
|
|
|
// try
|
|
|
|
|
// {
|
|
|
|
|
// string sub = context.Request.RequestContext.RouteData.Values["sub"].ToString();
|
|
|
|
|
// if (string.IsNullOrEmpty(sub))
|
|
|
|
|
// {
|
|
|
|
|
// sub = context.Request.Url.AbsoluteUri.GetSubdomain();
|
|
|
|
|
// }
|
|
|
|
|
// string title = config.Title;
|
|
|
|
|
// Page page = HttpContext.Current.Handler as Page;
|
|
|
|
|
|
|
|
|
|
// if (page != null)
|
|
|
|
|
// {
|
|
|
|
|
// title = page.Title;
|
|
|
|
|
// }
|
|
|
|
|
// var newContext = ((HttpApplication)sender).Context;
|
|
|
|
|
// Tracking.TrackPageView(new HttpRequestWrapper(newContext.Request), title, sub);
|
|
|
|
|
// }
|
|
|
|
|
// catch (Exception ex)
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected void Application_PostAuthenticateRequest(Object sender, EventArgs e) |
|
|
|
|