ASP.NET Tutorial/Development/DLL

Материал из .Net Framework эксперт
Перейти к: навигация, поиск

csc /target:library /reference:System.dll,System.Web.dll /out:CodingStrategies.dll SimpleModule.cs

using System;
using System.Web;
namespace CodingStrategies {
    class SimpleModule : IHttpModule {
      public void Init(HttpApplication application) {
        application.BeginRequest += new EventHandler(this.Application_BeginRequest);
      }
    
      public void Dispose() {
      }
    
      public void Application_BeginRequest(object source, EventArgs e) {
        HttpApplication application = (HttpApplication)source;
        application.Context.Response.Write("a module can end the request");
        application.Context.Response.End();
      }
    
    }
}