The next generation of the Teknik Services. Written in ASP.NET.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.0 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
using System.Web.UI;
using Teknik.Configuration;
using Teknik.Utilities;
using Teknik.Piwik;
namespace Teknik.Filters
public class TrackDownload : ActionFilterAttribute
public override void OnActionExecuting(ActionExecutingContext filterContext)
public override void OnActionExecuted(ActionExecutedContext filterContext)
HttpRequestBase request = filterContext.HttpContext.Request;
// Fire and forget. Don't need to wait for it.
Task.Run(() => AsyncTrackDownload(request, request.Url.ToString()));
private void AsyncTrackDownload(HttpRequestBase request, string url)
Config config = Config.Load();
Tracking.TrackDownload(request, config, url);