/// <summary>
///first write by 李天平
///up by ahuinan 2009-4-18
/// </summary>
public class PageBase:System.Web.UI.Page
{
public PageBase()
{
//
//TODO: 在此處添加構(gòu)造函數(shù)邏輯
//
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
this.Load += new System.EventHandler(PageBase_Load);
this.Error += new System.EventHandler(PageBase_Error);
}
//錯(cuò)誤處理
protected void PageBase_Error(object sender, System.EventArgs e)
{
string errMsg = string.Empty;
Exception currentError = HttpContext.Current.Server.GetLastError();
errMsg += "<h1>系統(tǒng)錯(cuò)誤:</h1><hr/>系統(tǒng)發(fā)生錯(cuò)誤, " +
"該信息已被系統(tǒng)記錄,請(qǐng)稍后重試或與管理員聯(lián)系。<br/>" +
"錯(cuò)誤地址: " + Request.Url.ToString() + "<br/>" +
"錯(cuò)誤信息: " + currentError.Message.ToString() + "<hr/>" +
"<b>Stack Trace:</b><br/>" + currentError.ToString();
HttpContext.Current.Response.Write(errMsg);
Server.ClearError();
}
private void PageBase_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
if (HttpContext.Current.Session["username"] != null)
{
HttpContext.Current.Response.Write("搜索吧sosuo8.com登陸測(cè)試");
}
else
{
HttpContext.Current.Response.Write("你不是阿會(huì)楠,不要登陸");
}
}
}
}
使用的時(shí)候:
代碼如下:
public partial class _Default :PageBase
{
protected void Page_Load(object sender, EventArgs e)
{
int ID = int.Parse(Request.QueryString["ID"]);
Response.Write("id:"+ID.ToString());
}
}
聲明:本網(wǎng)頁(yè)內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問(wèn)題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com