namespace MehmetDuran
{
public class Zaman : IHttpModule
{
public void Dispose() { }
public void Init(HttpApplication context)
{
context.BeginRequest += delegate(object sender, EventArgs e)
{
HttpContext Context = ((HttpApplication)sender).Context;
Stopwatch zaman = new Stopwatch();
Context.Items["zaman"] = zaman;
zaman.Start();
};
context.EndRequest += delegate(object sender, EventArgs e)
{
HttpContext Context = ((HttpApplication)sender).Context;
Stopwatch zaman = (Stopwatch)Context.Items["zaman"];
zaman.Stop();
if (Context.Response.ContentType == "text/html")
{
double SaniyeSure = (double)zaman.ElapsedTicks / Stopwatch.Frequency;
Context.Response.Write("Oluşturulma Süresi : " + SaniyeSure.ToString("F4") + " saniye.");
}
};
}
}
}