日期:2014-05-17 浏览次数:20417 次
public class UserAuthorizationModule : IHttpModule
{
public void Dispose() { }
public void Init(HttpApplication context)
{
context.AcquireRequestState += new EventHandler(Application_AcquireRequestState);
}
public void Application_AcquireRequestState(object sender, EventArgs e)
{
HttpApplication application = sender as HttpApplication;;
//HttpContext context = application.Context;
HttpResponse response = application.Context.Response;
Sys_Users Use = new Sys_Users();
//获取当前请求的虚拟路径
string Url = application.Context.Request.Path.ToString();
switch (Url)
{
case "/Web/index.htm":
case "/Web/main.htm":
case "/Web/menu.htm":
case "/Web/header.htm":
if (application.Context.Session["Session_User"] == null)
{
application.Context.Response.Redirect("login.htm");
return;
}
break;
}
}
}