473,795 Members | 2,999 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
Feb 28 '08 #1
1 6914
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:
http://forums.asp.net/t/954194.aspx?PageIndex=7
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:
http://weblogs.asp.net/scottgu/archi...x-patch-availa
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 (ji****@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.
Feb 29 '08 #2

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

Similar topics

0
1631
by: hlyall1189 | last post by:
Hi, I recently started upgrading some of my old vs 2003 apps to vs 2005 and used the conversion tool but now i get the following error after building the page. I have typecasted the lines as follows: ((StyleSheetProvider)this.Page).GetStyleSheetPath(); Is there some different way of typecasting that needs to be done in vs2005? Thanks in advance.
0
1082
by: Jeff | last post by:
Unable to cast object of type 'ASP.pgmaster_master' to type 'ASP.pgmaster_master'. I periodically get this error on VB .Net 2005 but then it will go away on it's own. I have no idea why this is occurring occasionally, and I've been unable to figure out when it tends to occur so that I can replicate it on will. Clearly it is related to the use of a master page, but other than that, I'm at a loss to understand why the application works...
2
2095
by: rn5a | last post by:
Suppose I have this property in a user control (which is named Address.ascx): <script runat="server"> Public Property Caption() As Object Get Caption = lblCaption.Text End Get Set(ByVal value As Object) lblCaption.Text = value
0
1304
by: BillE | last post by:
I get an intermittent error when I start a debug session for a vb.net web site which uses master/content pages: "Unable to cast object of type 'ASP.master' to type 'ASP.master'" I think this is not a bug in my code, because if I close Visual Studio and open it again the problem is gone, for a while. It recurs after several sessions. Is there a remedy for this?
1
3111
by: Chris | last post by:
Hi, I want to limit the amount of data shown in a page coming from a database. Everything works except that I get the error: "Unable to cast object of type 'System.Web.UI.WebControls.SqlDataSource' to type 'System.Collections.IEnumerable'" on line: PageDataSource.DataSource = SqlDataSource2 Thanks for help
35
3233
by: Chris | last post by:
Hi, I tried to create a class which must change the propety 'visible' of a <linktag in the masterpage into 'false' when the user is logged. But i get the error: "Object reference not set to an instance of an object" for the line 'If mpg.FindControl("lkred").Visible = True Then'. I couldn't find sofar the solution. Any help would be appreciated ... Thanks
1
2955
by: epatrick | last post by:
I have a series of custom controls developed under ASP.NET 1.1, and I've successfully migrated to ASP.NET 2.0. I have also developed a custom class dervied from System.Web.UI.Page, called qbo.Web.Page. All of these controls compile and run correctly under ASP.NET 2.0. However, several of these controls throw an error in the design mode of VS.NET 2005. Specifically, controls that include a property override of Page (to cast as a...
1
3755
by: =?Utf-8?B?RGF2ZQ==?= | last post by:
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:
1
2348
by: =?Utf-8?B?U2NvdHQ=?= | last post by:
Hello, Using VS2008 in a C# web service application, a class has been created that inherits from the ConfigurationSelection. This class file has been placed in the App_Code folder. The web.config has been updated with the necessary section. Using System.Web.Configuration.WebConfiguration.GetSection(), the config information is returned without any issues when the GetSection is set to an object. When the object is casted explicitly...
0
9522
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10217
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10167
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10003
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7544
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6784
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5566
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4114
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.