一、基类源代码
using System;
using System.Web.SessionState;
namespace s2p.Application.Teacher
{
/// <summary>
/// 用于测试的自动赋予session的页面基类
/// </summary>
public class BasePage:System.Web.UI.Page
{
public BasePage()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
protected override void OnInit(EventArgs e)
{
if (Session["SchoolID"]==null)
{
Session["Account"]="jimzhang";
Session["Password"]="********";
Session["Identify"]="********";
}
base.OnInit(e);
//判断session是否过期
s2p.WebComponents.ComFunction strCon=new s2p.WebComponents.ComFunction();
if (Session["Account"]==null)
{
Response.Write(strCon.InforJumpParent("../../login.htm","您在该页面停留时间过长,请重新登陆!"));
Response.End();
}
return;
}
}
}
二、应用方式;
public class ScoreOrderWebExe : BasePage//System.Web.UI.Page