473,396 Members | 1,786 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Erratic Masterpage exception

I have a masterpage named MasterpageController with a menu. In the
codebehind I have a method SetMasterMenu(<some parms>) to display the
appropriate menu items.
The content page, which has a MasterType directive, executes the method
using "this.Master.SetMasterMenu(<some parms>)". Runs fine for maybe 5-10
"start with/without debugging"'s, while I am in development mode in vs.net
2005, and then I'll start getting an "Unable to cast object of type
'ASP.masterpagecontroller_master' to type 'ASP.masterpagecontroller_master'"
when the content page attempts to execute the method. I have to restart IIS
to get the app to run correctly .. then a few starts later I get the
exception.
Any ideas on how to fix this?
Jan 15 '08 #1
3 1236
SandpointGuy,
>I have a masterpage named MasterpageController with a menu. In the
codebehind I have a method SetMasterMenu(<some parms>) to display the
appropriate menu items.
The content page, which has a MasterType directive, executes the method
using "this.Master.SetMasterMenu(<some parms>)". Runs fine for maybe 5-10
"start with/without debugging"'s, while I am in development mode in vs.net
2005, and then I'll start getting an "Unable to cast object of type
'ASP.masterpagecontroller_master' to type
'ASP.masterpagecontroller_master'"
when the content page attempts to execute the method. I have to restart
IIS
to get the app to run correctly .. then a few starts later I get the
exception.
Any ideas on how to fix this?Sounds like you might want to upgrade to
VS2008.
I've never seen this error but looks like you're not the only one.

See http://forums.asp.net/p/954194/1184928.aspx.

Then, on page 2, Microsoft replies with:

"This particular exception error can happen a number of ways (most typically
due to developer error), which is why it took awhile to figure out what was
happening and identify the bug.

As Ryan mentioned above, we are releasing a QFE hotfix that will be
available in a few weeks (QFE reference #4039). It is in testing right now
and we'll release it once we have confirmation from a number of customers
who have reported it that it fixes the issue.

As a temporary workaround, you can also disable batch compilation when
deploying your production apps. This can be done by setting the
<compilation batch="false"attribute in web.config. This will avoid the
problem occuring in a production environment.

Note that you want to be careful using the above switch at development
time -- since it will slow does VS compiles quite a bit. But if you want to
be safe when you deploy files you can enable it until the QFE comes out."

This was posted in February of 2006.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

Jan 15 '08 #2
Thanks.
I had been running this code for months without the problem.
I have been working on an .ascx control to do file uploads from. I dragged
it onto a page and this started happening. The page I dragged it onto isnt
executed when this problem happens. But if I were asked what was different
since yesterday, I would point to this.

"Jonathan Wood" wrote:
SandpointGuy,
I have a masterpage named MasterpageController with a menu. In the
codebehind I have a method SetMasterMenu(<some parms>) to display the
appropriate menu items.
The content page, which has a MasterType directive, executes the method
using "this.Master.SetMasterMenu(<some parms>)". Runs fine for maybe 5-10
"start with/without debugging"'s, while I am in development mode in vs.net
2005, and then I'll start getting an "Unable to cast object of type
'ASP.masterpagecontroller_master' to type
'ASP.masterpagecontroller_master'"
when the content page attempts to execute the method. I have to restart
IIS
to get the app to run correctly .. then a few starts later I get the
exception.
Any ideas on how to fix this?Sounds like you might want to upgrade to
VS2008.

I've never seen this error but looks like you're not the only one.

See http://forums.asp.net/p/954194/1184928.aspx.

Then, on page 2, Microsoft replies with:

"This particular exception error can happen a number of ways (most typically
due to developer error), which is why it took awhile to figure out what was
happening and identify the bug.

As Ryan mentioned above, we are releasing a QFE hotfix that will be
available in a few weeks (QFE reference #4039). It is in testing right now
and we'll release it once we have confirmation from a number of customers
who have reported it that it fixes the issue.

As a temporary workaround, you can also disable batch compilation when
deploying your production apps. This can be done by setting the
<compilation batch="false"attribute in web.config. This will avoid the
problem occuring in a production environment.

Note that you want to be careful using the above switch at development
time -- since it will slow does VS compiles quite a bit. But if you want to
be safe when you deploy files you can enable it until the QFE comes out."

This was posted in February of 2006.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

Jan 15 '08 #3
I would bet on caching to be a problem..
LoadControl (which might be used with master pages inexplicitly) function
will return not a reference to an object but reference to
PartialCachingControl which might be not your object you trying to cast
to...

So try to investigate into that direction...

George

"Jonathan Wood" <jw***@softcircuits.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
SandpointGuy,
>>I have a masterpage named MasterpageController with a menu. In the
codebehind I have a method SetMasterMenu(<some parms>) to display the
appropriate menu items.
The content page, which has a MasterType directive, executes the method
using "this.Master.SetMasterMenu(<some parms>)". Runs fine for maybe
5-10
"start with/without debugging"'s, while I am in development mode in
vs.net
2005, and then I'll start getting an "Unable to cast object of type
'ASP.masterpagecontroller_master' to type
'ASP.masterpagecontroller_master'"
when the content page attempts to execute the method. I have to restart
IIS
to get the app to run correctly .. then a few starts later I get the
exception.
Any ideas on how to fix this?Sounds like you might want to upgrade to
VS2008.

I've never seen this error but looks like you're not the only one.

See http://forums.asp.net/p/954194/1184928.aspx.

Then, on page 2, Microsoft replies with:

"This particular exception error can happen a number of ways (most
typically due to developer error), which is why it took awhile to figure
out what was happening and identify the bug.

As Ryan mentioned above, we are releasing a QFE hotfix that will be
available in a few weeks (QFE reference #4039). It is in testing right
now and we'll release it once we have confirmation from a number of
customers who have reported it that it fixes the issue.

As a temporary workaround, you can also disable batch compilation when
deploying your production apps. This can be done by setting the
<compilation batch="false"attribute in web.config. This will avoid the
problem occuring in a production environment.

Note that you want to be careful using the above switch at development
time -- since it will slow does VS compiles quite a bit. But if you want
to be safe when you deploy files you can enable it until the QFE comes
out."

This was posted in February of 2006.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

Jan 15 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Keith Patrick | last post by:
I've got an app where the my page handles an exception. However, because the controls that should change are actually in the MasterPage, I need to bubble the event "up" to the .Master member. ...
0
by: Dennis | last post by:
I thought some might be interested in an erratic error that I finally found in my program: I had a class that opened a filestream for a file which I inadvertently forgot to close after it was...
3
by: Newbie | last post by:
Hi, For my recent web project, I need to built a site which has 3 language. The content pages are identical, so it only the language that differ. What I planned is: I'll build a masterpage for...
5
by: Islamegy® | last post by:
In my project i have two master page which i change dynamic in runtime.. The first one with 1 ContentPanel "onepanel.master", the second with 2 contentPanel"twopanel.master".. but when i switch...
12
by: Mark Rae | last post by:
Hi, It's easy enough for a child page to manipulate its MasterPage's header simply by modifying the MasterPage thus: <header runat="server"> .... .... </header>
4
by: cevans | last post by:
Is there a way to load a MasterPage programmatically? Not switch a page's masterpage but to create a MasterPage object that holds a given masterpage. So I know I can do: MasterPage master =...
0
by: srilatk | last post by:
Hi, I have an asp.net web page that invokes a web service. The WS searches the database for data relevant to the search critieria like date, transaction no etc. This works fine and retirves data...
2
by: =?Utf-8?B?RGFsZQ==?= | last post by:
I have an app with a MasterPage. In the MasterPage is a user control with several public properties and methods that I want exposed to the content page. Rather than writing several redirection...
1
by: GaryDean | last post by:
"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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.