Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of github.com:managedfusion/managedfusion-web

  • Loading branch information...
commit f8635714aa9ab4a07366cbecc9a44cf1fa95712f 2 parents 8674b6b + 06b2e30
@nberardi nberardi authored
Showing with 6 additions and 9 deletions.
  1. +6 −9 src/Web/Mvc/StopwatchAttribute.cs
View
15 src/Web/Mvc/StopwatchAttribute.cs
@@ -6,21 +6,18 @@ namespace ManagedFusion.Web.Mvc
{
public class StopwatchAttribute : ActionFilterAttribute
{
- private Stopwatch _stopwatch;
-
- public StopwatchAttribute()
- {
- _stopwatch = new Stopwatch();
- }
-
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
- _stopwatch.Start();
+ var stopwatch = new Stopwatch();
+ filterContext.HttpContext.Items["Stopwatch"] = stopwatch;
+
+ stopwatch.Start();
}
public override void OnActionExecuted(ActionExecutedContext filterContext)
{
- _stopwatch.Stop();
+ var stopwatch = (Stopwatch)filterContext.HttpContext.Items["Stopwatch"];
+ stopwatch.Stop();
var httpContext = filterContext.HttpContext;
var response = httpContext.Response;
Please sign in to comment.
Something went wrong with that request. Please try again.