using System; using System.Web; /// Error 404 handler helper. 2008-10-20 /// public class Redirection404Helper : IHttpModule { public void Dispose() {} public void Init(HttpApplication context) { context.Error += new EventHandler(On404Error); } void On404Error(object sender, EventArgs e) { HttpApplication httpApplication = sender as HttpApplication; if (httpApplication == null) return; HttpContext httpContext = httpApplication.Context; HttpException httpException = httpContext.Error as HttpException; if (httpException == null) return; if (httpException.GetHttpCode() == 404) httpContext.Server.Transfer(httpContext.Request.ApplicationPath + @"/errors/Redirection-404.aspx?aspxerrorpath=" + httpContext.Request.RawUrl); } }