Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
I am getting this error while using
 ((System.Web.UI.WebControls.Label)this.Master.FindControl("lblErr")).Text = "";
 
means i am calling Master page Label but when i am accessing Asp pages from Client i am getting ths error but on server its run perfectly
 
[A]ASP.site_master cannot be cast to [B]ASP.site_master. Type A originates from 'App_Web_bwoe4mfw, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' in the context 'Default' at location 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\erp\5c2ea699\4c38a279\App_Web_bwoe4mfw.dll'. Type B originates from 'App_Web_zco24bnv, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
Posted 6-Jan-13 23:56pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

hi,
 
You can create a property or method in master page that will take a string parameter and set it as a text to the error label control.
 
and then you can call that method from inside the content page code.
 
e.g.
 
Define a method in Master page like :
 
public void SetError (string ErrorMsg)
{
     lblError.Text = ErrorMsg;
}
 
and in content page set the message by calling this method as :
 
this.Master.SetError("Error Message Here");
 
To be able to access master page's methods or properties you have to define the master type in the page's aspx code as follows:
 
<%@ MasterType VirtualPath="~/MasterPage.master" %>
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

When this happened to me, I had already done the things @Er-Gayatri had suggested above, and the page had been working, literally for years, as it was.
 
I just had to "Rebuild All" and restart Visual Studio and it started doing it right again. Not sure the rebuild was even necessary.
 
[speculation]
I'm guessing that the currently running instance of VS had a reference in its debug whatever to a generated asp.NET dll that it forgot to update after the dll had been regenerated at some point, and needed to reboot to sort it out.
"What good is it to know that you've forgotten something when you cannot remember what it is that you've forgotten?"
[/speculation]
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 530
1 Sergey Alexandrovich Kryukov 330
2 BillWoodruff 299
3 PIEBALDconsult 230
4 CPallini 220
0 Sergey Alexandrovich Kryukov 10,615
1 Maciej Los 5,354
2 OriginalGriff 5,254
3 CPallini 3,719
4 BillWoodruff 3,476


Advertise | Privacy | Mobile
Web03 | 2.8.141029.1 | Last Updated 25 Aug 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100