473,785 Members | 3,067 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 6911
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
1081
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
3232
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
3754
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
2347
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
9645
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
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
10325
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9950
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
7499
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
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4053
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
3646
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.