Unable to cast object of type 'ASP.masterpage_master' to type 'MasterPage

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • GaryDean

    #1

    Unable to cast object of type 'ASP.masterpage_master' to type 'MasterPage

    "Unable to cast object of type 'ASP.masterpage _master' to type 'MasterPage"

    This code has always worked but today it is getting the exception in the
    subject line of this post...

    protected void Page_Load(objec t sender, EventArgs e)
    {

    this.Master.Hea dingLabel.Text = "Direct 4506 Purchase"; <--this
    gets the cast exception

    I'm changing a public property in the master page- we do it all the time. I
    googled the error and a lot of people were getting it back in 2006 where it
    had to do with a caching bug in IIS I think. Why would I suddenly get this
    today? I bounced IIS reloaded the project but to no avail.
    Thanks,
    Gary


  • Jialiang Ge [MSFT]

    #2
    Re: Unable to cast object of type 'ASP.masterpage _master' to type 'MasterPage

    Hello Gary,

    Yes, you are right. I confirmed with the ASP.NET team. The hotfix was
    released on 4/12/2007, and it has been included into .NET Framework 2.0 SP1
    (See: Problems that are fixed in the .NET Framework 2.0 SP1
    http://support.microsoft.com/kb/945757). I think the KB article
    http://support.microsoft.com/kb/915782/en-us does need an update to reflect
    this. I will file a request to the KB team and ask them to update the
    article as soon as possible. Thank you for pointing it out.

    The "batch" attribute in the <compilationele ment indicates whether
    batching is supported. If True (default to be true), eliminates the delay
    caused by the compilation when you access a file for the first time.
    ASP.NET precompiled all the uncompelled files in a batch mode, which causes
    an even longer delay the first time the files are compiled. However, after
    this initial delay, this compilation delay is eliminated on subsequent
    access of the file. If this attribute is False, we turn off the batch
    compilation on the web site. See MSDN article
    http://msdn2.microsoft.com/en-us/library/s10awwz0.aspx

    I also see a lot of community member say that batch="false" can resolved
    the problem:
    A broad category of Microsoft tools, languages, and frameworks for software development. Designed to support developers in building, debugging, and deploying applications across various platforms.

    and Scott Guthrie from Microsoft agreed that it can fix the problem. This
    doesn't impact runtime performance. IIS also doesn't recompile when the
    application restarts unless there has been a code or configuration change
    that requires it - so you won't have performance issues related to that
    unless you are making code changes on the live site.

    Scott Guthrie has a great blog entry at:

    ble-for-asp-net-compilation-issues.aspx
    This explains the resolution of the issue in detail.

    If you have any other concern or need anything else, please feel free to
    let me know.

    Thanks
    Jialiang Ge (jialge@online. microsoft.com, remove 'online.')
    Microsoft Online Community Support

    =============== =============== =============== ====
    When responding to posts, please "Reply to Group" via your newsreader
    so that others may learn and benefit from your issue.
    =============== =============== =============== ====
    This posting is provided "AS IS" with no warranties, and confers no rights.


    Comment

    Working...