protected void Application_BeginRequest(Object sender, EventArgs e)
{
//例外,该页面不做处理。获得当前页面的名字
string strUrl = Request.Url.Segments[Request.Url.Segments.GetUpperBound(0)];
if (strUrl!="Login.aspx")
{
//判断是否登录
if (Session["uid"]==null)
{
Response.Redirect("Login.aspx");
}
}
}
有的人说:这段话还没有Session
{
//例外,该页面不做处理。获得当前页面的名字
string strUrl = Request.Url.Segments[Request.Url.Segments.GetUpperBound(0)];
if (strUrl!="Login.aspx")
{
//判断是否登录
if (Session["uid"]==null)
{
Response.Redirect("Login.aspx");
}
}
}
有的人说:这段话还没有Session
Application_BeginRequest 这时还没有sesson
你应该看看asp.net 的页面生命周期