ASP.MVC Filter that pass along Google Analytics utm querystring parameters

I’m trying to build a filter that when applied pass alongs “utm_” querystring params

This is what I came up with:

public class PassAlongParametersFilter : FilterAttribute, IResultFilter
{
    public string Filter { get; set; }

    public PassAlongParametersFilter()
    {
        Filter = "*";
    }

    public void OnResultExecuting(ResultExecutingContext filterContext)
    {
    }

    public void OnResultExecuted(ResultExecutedContext filterContext)
    {
        if (filterContext.Result is RedirectToRouteResult)
        {
            var action = (RedirectToRouteResult) filterContext.Result;

            var qs = filterContext.RequestContext.HttpContext.Request.QueryString;

            var regex = StringUtils.WildcardToRegex(Filter);

            var routeValues = action.RouteValues;

            qs.AllKeys.Where(e => Regex.IsMatch(e, regex)).ForEach(s => routeValues[s] = qs[s]);

            filterContext.Result = new RedirectToRouteResult(action.RouteName, routeValues, action.Permanent);
        }
    }
}

read more

ASP.MVC Filter that pass along Google Analytics utm querystring parameters

I’m trying to build a filter that when applied pass alongs “utm_” querystring params

This is what I came up with:

public class PassAlongParametersFilter : FilterAttribute, IResultFilter
{
    public string Filter { get; set; }

    public PassAlongParametersFilter()
    {
        Filter = "*";
    }

    public void OnResultExecuting(ResultExecutingContext filterContext)
    {
    }

    public void OnResultExecuted(ResultExecutedContext filterContext)
    {
        if (filterContext.Result is RedirectToRouteResult)
        {
            var action = (RedirectToRouteResult) filterContext.Result;

            var qs = filterContext.RequestContext.HttpContext.Request.QueryString;

            var regex = StringUtils.WildcardToRegex(Filter);

            var routeValues = action.RouteValues;

            qs.AllKeys.Where(e => Regex.IsMatch(e, regex)).ForEach(s => routeValues[s] = qs[s]);

            filterContext.Result = new RedirectToRouteResult(action.RouteName, routeValues, action.Permanent);
        }
    }
}

read more

10 Commandments to Create Compelling Content

10-commandments-compelling-content-cover

Compelling content – everyone talks about it, yet it is as difficult to articulate as it is to create. Seminar after seminar, blog post after blog post, content marketers provide the same trite advice: Create compelling content.

This is usually followed by examples of compelling brand content in various mediums – videos, infographics, memes, e-books, podcasts, etc.

It’s as though the answer to the million-dollar question of how to compel people with content is – make the content compelling.

read more