Analytics in C #

I use Microsoft Enterprise Library Logging in C # to log events in SQL DB, and I use these records for analytics purposes.

Is there a better way for analytics in C #. for example, "Microsoft StreamInsight from SQL Server 2008".

Another way is to embed Javascript in the HTML code that uses Google Analytics. But this way I have to send all my logging data to the log section in the HTTP message.

thank

+5
source share
3 answers

Interestingly, if you want to track your users, this is an action filter.

ASP.NET MVC 3, , .

HttpContext .

public class TrackerFilterAttribute : ActionFilterAttribute
{

    public TrackerFilterAttribute()
    {
    }

    public override void OnActionExecuting(ActionExecutingContext filterContext)
    {
        base.OnActionExecuting(filterContext);

        //TODO: Do my tracking here.
    }
}

:

public class MvcApplication : System.Web.HttpApplication
{
    public static void RegisterGlobalFilters(GlobalFilterCollection filters)
    {
        filters.Add(new HandleErrorAttribute());
        filters.Add(new TrackerFilterAttribute());
    }

    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            "Default", // Route name
            "{controller}/{action}/{id}", // URL with parameters
            new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
        );

    }

    protected void Application_Start()
    {
        AreaRegistration.RegisterAllAreas();

        RegisterGlobalFilters(GlobalFilters.Filters);
        RegisterRoutes(RouteTable.Routes);
    }
}
+2

- , . #, , .

0

StreamInsight -. , SI, perfmon -, . , . StreamInsight . .

0

All Articles