using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace web.Code
{
    public class Modles:IHttpModule
    {
        public void Dispose(){}

        public void Init(HttpApplication context)
        {
            context.BeginRequest += new EventHandler(context_BeginRequest);
        }

        void context_BeginRequest(object sender, EventArgs e)
        {
            
            var content = (HttpApplication)sender;
            content.Server.ScriptTimeout = 15;
            var url = content.Request.Url.LocalPath;
            if (url.ToLower().EndsWith(".html") || url.ToLower().EndsWith(".htm"))
            {
                new Eng(content);
                TemplateRender tr = new TemplateRender("/");
                foreach (var item in ConfigKey.Keys)
                {
                    tr.Put(item.Key, item.Value);
                }
                tr.Put("http_content", content);
                tr.Show(url);
            }
        }
    }
}