I have a piece of code.
public partial class Extension
{
public Extension(object Instance)
{
ControlCollection Controls = null;
if (Instance.GetType().BaseType.Name != typeof(ITWebMasterPage).BaseType.Name)
Controls = ((ITWebBasePage)Instance).Form.Controls;
if (Instance.GetType().BaseType.Name == typeof(ITWebMasterPage).BaseType.Name)
Controls = ((ITWebMasterPage)Instance).Controls;
if (Controls != null)
ExtendPage(Instance, Controls);
else
throw new SystemException("This object cannot be extended.");
}
Error:
Server Error in '/' Application.
--------------------------------------------------------------------------------
Unable to cast object of type 'ASP.masterpages_root_master' to type 'ITWeb.ITWebBasePage'.
Description: An unhandled exception occurred ...
Go to the complete details ...