|
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Web.Security;
/// <summary>
/// Summary description for BasePage
/// </summary>
public class BasePage : System.Web.UI.Page
{
#region Public Methods
public void HandleException(Exception ex)
{
if (ConfigurationManager.AppSettings["Environment"] == "Development")
{
Master.ErrorMessage = ex.Message;
}
else
{
Master.ErrorMessage = "An unexpected error has occured in the application. If it continues, please contact the administrator.";
}
// TODO Log the exception somehow, either with Microsoft.Practices.EnterpriseLibrary.Logging or some other mechanism
}
#endregion
#region Public Properties
public MembershipUser CurrentUser
{
get { return Session["CurrentUser"] as MembershipUser; }
set { Session["CurrentUser"] = value; }
}
public new BaseMasterPage Master { get { return (BaseMasterPage)base.Master; } }
public string ErrorMessage
{
set { Master.ErrorMessage = value; }
}
public string InformationMessage
{
set { Master.InformationMessage = value; }
}
public string WarningMessage
{
set { Master.WarningMessage = value; }
}
#endregion
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.