我該如何去做這件事?發生在不同頁面上的ASP.net記錄錯誤
protected void Page_Load(object sender, EventArgs e)
{
try
{
doSomething();
}
catch (Exception ex)
{
// Here i would like to know that the page is "Problem.aspx"
// and that it was caused from the doSomething() function
}
}
private void doSomething()
{
logToSomething();
}
如此多的不必要的代碼,當您可以設置企業庫日誌記錄塊,並且全部爲您完成。 – Kon