日期:2014-05-17 浏览次数:20427 次
public class HttpModule : IHttpModule { private HttpContext context; private string Root; private string Url; public void Dispose() { } public void Init(HttpApplication context) { this.context = context.Context; Root = this.context.Request.ApplicationPath; context.BeginRequest += new EventHandler(Application_BeginRequest); } private void Application_BeginRequest(object sender, EventArgs e) { context = sender.To<HttpApplication>().Context; Url = context.Request.Url.LocalPath.ToLower(); if (string.IsNullOrEmpty(Url.RegExReplace(Root+"/index", ""))) { context.RewritePath(Root+"/Index.aspx"); } } }