Skip to content

Instantly share code, notes, and snippets.

@hatelove
Created November 6, 2012 10:08
Show Gist options
  • Save hatelove/4023837 to your computer and use it in GitHub Desktop.
Save hatelove/4023837 to your computer and use it in GitHub Desktop.
/// <summary>
/// GrandFather 的摘要描述
/// </summary>
public class GrandFather : System.Web.UI.Page
{
protected virtual int GetExpireMinutes()
{
return 480;
}
protected override void OnPreInit(EventArgs e)
{
base.OnPreInit(e);
Response.Write("GrandFather Page_PreInit" + "<br/>");
var minutes = this.GetExpireMinutes();
Response.Write(string.Format("expire minutes:{0}", minutes) + "<br/>");
}
}
/// <summary>
/// Father 的摘要描述
/// </summary>
public class Father : GrandFather
{
protected override void OnPreInit(EventArgs e)
{
base.OnPreInit(e);
Response.Write("Father Page_PreInit" + "<br/>");
}
}
//個別設定的子頁面
public partial class Sample : Father
{
protected override int GetExpireMinutes()
{
return 10;
}
protected void Page_PreInit(object sender, EventArgs e)
{
Response.Write("Sample Page_PreInit" + "<br/>");
}
protected void Page_Load(object sender, EventArgs e)
{
}
}
//預設的子頁面
public partial class _Default : Father
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment