Unable to cast object

Discussion in 'ASP General' started by Dave, Apr 19, 2007.

  1. Dave

    Dave Guest

    I have a master page and a content page to that master.

    When I try to work with them I get an inconsistent error of casting ability
    and it happens irregularly, which means sometimes it can work and sometimes
    not, without making any changes to the code.

    Is this a bug concern? Or do you have any advice for this issue?

    Here is the error message I get:

    Server Error in '/LocalIms' Application.
    --------------------------------------------------------------------------------

    Unable to cast object of type 'ASP.masterims_master' to type 'MasterIms'.

    Description: An unhandled exception occurred during the execution of the
    current web request. Please review the stack trace for more information about
    the error and where it originated in the code.

    Exception Details: System.InvalidCastException: Unable to cast object of
    type 'ASP.masterims_master' to type 'MasterIms'.

    Source Error:

    Line 22: protected void Page_Load(object sender, EventArgs e)

    Line 23: {

    Line 24: MasterIms master = (MasterIms)this.Master;

    Line 25: master.LeftBarPlayerVisibility = false;

    Line 26: master.LeftBarSearchVisibility = true;

    Source File: c:\Documents and Settings\liors\Desktop\LocalIms\Sm.aspx.cs
    Line: 24

    Stack Trace:

    [InvalidCastException: Unable to cast object of type 'ASP.masterims_master'
    to type 'MasterIms'.]

    Sm.Page_Load(Object sender, EventArgs e) in c:\Documents and
    Settings\liors\Desktop\LocalIms\Sm.aspx.cs:24

    System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o,
    Object t, EventArgs e) +13

    System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender,
    EventArgs e) +45

    System.Web.UI.Control.OnLoad(EventArgs e) +80

    System.Web.UI.Control.LoadRecursive() +49

    System.Web.UI.Page.ProcessRequestMain(Boolean
    includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3745

    --------------------------------------------------------------------------------

    Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET
    Version:2.0.50727.42
     
    Dave, Apr 19, 2007
    #1
    1. Advertising

  2. Dave wrote:
    > I have a master page and a content page to that master.
    >

    There was no way for you to know it (except maybe by browsing through some
    of the previous questions in this newsgroup before posting yours - always a
    recommended practice) , but this is a classic asp newsgroup. ASP.Net bears
    very little resemblance to classic ASP so, while you may be lucky enough to
    find a dotnet-knowledgeable person here who can answer your question, you
    can eliminate the luck factor by posting your question to a group where
    those dotnet-knowledgeable people hang out. I suggest
    microsoft.public.dotnet.framework.aspnet.

    I've not started using that technology yet so I cannot attempt an answer
    here.

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
     
    Bob Barrows [MVP], Apr 19, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mminto
    Replies:
    0
    Views:
    9,888
    mminto
    Jan 20, 2006
  2. Imran Aziz
    Replies:
    4
    Views:
    8,736
    ljenner01
    Jan 19, 2011
  3. =?Utf-8?B?c2Ft?=
    Replies:
    0
    Views:
    1,756
    =?Utf-8?B?c2Ft?=
    Jan 12, 2006
  4. Replies:
    2
    Views:
    3,091
    silverfox_1188
    Aug 16, 2006
  5. Replies:
    0
    Views:
    923
Loading...

Share This Page