using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
namespace JudgeSessionOutTime
{
public class JudgeSession : System.Web.UI.Page
{
protected override void OnInit(EventArgs e)
{
if (Session["username"] == null)
{
Response.Write("session过期!");
}
else
{
Response.Write("session没有过期,用户名:"+Session["username"].ToString());
}
}
}
}
优点:方法灵活,代码重用率高。在需要判断session的页面继承JudgeSession类,不需要的页面,继承page类即可。
您可能感兴趣的文章: