Asp – NIGHTMARE (Night of the Living Dead – WAP conversion): Endless Loop of Reference/Reciprocal errors (Impossible Puzzle to Solve?)

asp.net

Please read this carefully in its entirety and think about it before replying. It might be a simple fix but I highly doubt it. You have to understand the scenario here and conflicts I'm explaining fully to be able to help me.

So I have copied over our web site code to a WAP project. I got rid of any reference errors. Believe me I've checked every single error. Now here comes my problem and hypothesis (it can't be solved):

We have a master page which has a bunch of public properties in it.

Almost all our .aspx.cs code is referencing some sort of property from Master and using it.

However, on the flip side, our master page cannot recognize any of my user or custom control tags that I've registered in the Master page. The register tags are fine. These were all referencing just fine together in a Web Site Project (both the master page was referencing its references to some user and custom controls and any .aspx.cs was referencing any master page public properties jsut fine).

So, if you think about this, this could be an endless loop that can never get resolved in this WAP conversion. Why? Because the way I see it, if my Master page can't reference the few user controls or custom controls in it, my master page will not compile. If the reason that my master page cannot compile and reference these user and custom controls is because there are "other errors" and those other errors being that .aspx.cs files error out because they get errors referncing the master page public properties then we have a real problem. It's like both are erroring out because both relate to each other and have problems that cannot get resolve because they're related! Do you catch my drift?

Let me give an example / analogy to put this into perspective.

MyMasterPage.aspx

(example code in it)

<%@ Register Src="~/WebControls/User/Navbar.ascx" TagName="Navbar" TagPrefix="ac" %>

<%@ Register TagPrefix="am" Namespace="[ourglobalnamespace].Controls.Custom" %>

<tr>
    <td valign=top runat="server" id="tdNavBar"><ac:Navbar runat="server" id="navbar"></ac:Navbar></td> (this references a user control and is blowing up)
</tr>

...

<tr>
        <td><am:NavigationPath runat="server" id="navPath" Seperator="&raquo;" /></td> (this references a custom control and is blowing up)
    </tr>

Right now I get errors saying it doesn't recognize either of the controls above for whatever reason I cannot understand

MyMasterPage.aspx.cs

   public BL.Store Store  
   {  
      get { return this.store; }  
   }  

   public BL.Product Product  
   {  
      get { return this.product; }  
   }  

just showing some public properties we're exposing through the Master Page's code behind. These properties are referenced and used in .aspx.cs code behind classes throughout our code.

Example .aspx .cs using the Master Page Properties:

   protected override void OnInit(EventArgs e)  
   {  
      int productID = Master.ProductID;  
      product = Master.Product;  

        protected override void OnInit(EventArgs e)
        {
            int productID = Master.ProductID;
            product = Master.Product;
         ...

So imagine I now have 1500+ errors mainly due to 2 reasons and they are not becuase of reference errors (I fixed all that):

1) Master Page cannot compile

2) Code-behind for .aspx pages blow up because Master page cannot compile therefore any references to Master Page properties cause the code behind to blow up

how the hell would I be able to resolve this if both errors practically rely on each other to be fixed? It's impossible!

3) Designer files cannot be generated for those remaining files that have these problems. So I am not able to right click the Master Page and those user controls in order to convert to web application so that it will successfully create the .designer.cs files for them

so we really have 3 problems (3rd being an after effect fo 1&2) that I have no idea how to resolve here all stemming from the Master page blowing up but could be blowing up because the code-behind pages are blowing up that reference the properties of the master page that is also blowing up! Do you catch my drift?

I hope it's something stupid simple that I've overlooked but I've spent a couple days on this and I see nothing else that will allow me to resolve this mess.

Someone shoot me to get rid of this conversion pain. If anyone can help me resolve this I swear I will send you a fing case of Beer!

Best Answer

In my experience, most of the pain from converting a web site to a WAP is due to namespace mismatches. Check that your master page and pages that use it are in the same namespace. And verify that the ,aspx files reference the correct namespace for the code behind files in the Inherits attribute.