CheckSessionHttpModult

namespace CZBK.TestProject.Common
{
public class CheckSessionHttpModult:IHttpModule
{
public void Dispose()
{
throw new NotImplementedException();
}

public void Init(HttpApplication context)
{
context.AcquireRequestState+=context_AcquireRequestState;
}
public void context_AcquireRequestState(object sender, EventArgs e)
{
HttpApplication application = (HttpApplication)sender;
HttpContext context=application.Context;
string filePath=context.Request.Url.ToString();
if (filePath.Contains("Admin"))
{
if (context.Session["userInfo"] == null)
{
context.Response.Redirect("/Login.aspx");
}
}
}
}
}

时间: 2024-12-23 06:21:10

CheckSessionHttpModult的相关文章