App can't find reference to ApplicationBasePage


Author
Message
Jeff Pagley
Jeff Pagley
StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)
Group: StrataFrame Users
Posts: 223, Visits: 893
I am attempting to integrate SF into an existing Web app.  The SF Web sample is working fine.  From what I can tell, I have setup the existing Web app with all of the same folders and references as the sample.  However, when I try to inherit the ApplicationBasePage it tells me it can't find it (see code below)

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace CampaignTracker {
    public partial class _Default :  ApplicationBasePage

    {
        protected void Page_Load(object sender, EventArgs e) {

        }
      
    }
}

What am I missing?

Thanks,

Jeff
StrataFrame Team
S
StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
There should be an ApplicationBasePage template that you can use to add a new one to your project.  If it's not there, it might be because you're in a website instead of a web app or something like that.  

The code is quite straightforward:

using MicroFour.StrataFrame.Tools;
using System.Web.Configuration;

public class ApplicationBasePage : MicroFour.StrataFrame.UI.Web.BasePage, ITypeResolver
{

#region [ Business Object Declarations ]

   //-- Business Objects defined within this class will be available to 
   //   inherited pages as binding sources to bindable controls.  These 
   //   business objects will also be persisted within session variables 
   //   and retrieved each time the page loads.
        
#endregion

#region [ ITypeResolver Implementation ]

    /// <summary>
    /// Must be used by the StrataFrame Application Framework to resolve a 
    /// type within this ASP.NET project due to the fact that the Entry Assembly 
    /// cannot be evaluated in an ASP.NET application.
    /// </summary>
    /// <param name="TypeName"></param>
    /// <returns></returns>
    /// <remarks></remarks>
    public System.Type ResolveType(string TypeName)
    {    
        //-- Return the gettype for the given TypeName
        return System.Type.GetType(TypeName, false, true);
    }
    
    /// <summary>
    /// Required by the base class to allow the StrataFrame Application Framework 
    /// to access the assemblies referenced by this project.
    /// </summary>
    /// <returns></returns>
    /// <remarks></remarks>
    public CompilationSection GetCompilationSection()
    {
      return (CompilationSection) WebConfigurationManager.GetSection("system.web/compilation");
    }
    
#endregion

}
Jeff Pagley
Jeff Pagley
StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)
Group: StrataFrame Users
Posts: 223, Visits: 893
Hi Ben,

I had already added the ApplicationBasePage in the App_Code folder just like the working sample so that is not the problem.  This is my first ASP.NET app.  As you had mention, I just realize I am working with a web app and not a website.  Because I am new, I am not sure what the difference is.  So what is the difference and what do I need to do to get SF integrated into the Web app.

Thanks,

Jeff
StrataFrame Team
S
StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
The difference is that the web site works more like a basic folder containing a bunch of independent web pages.  The pages are generally compiled upon request, so you can deploy a single page at a time or modify a page without needing to redeploy the entire web site.  The web apps generally require you to redeploy the entire thing together because it is compiled into a DLL and the .aspx pages are just placeholders.  If you look at the deployed copies, they are mostly empty.  The web app acts more like a typical .NET assembly project with the way it references other assemblies and such and we find web apps just easier to work with.

The most likely issue is a namespace resolution problem.  The ApplicationBasePage is in a different namespace than the rest of the site, and it's not always easy to figure it out.  You might be able to use the "Resolve" feature of C# to find the namespace to the class.  Right-click ApplicationBasePage in your WebForm and choose "Resolve -> using 'Namespace'" from the context menu and it will add the appropriate using statement to the top of the class (this is one of the best features that C# has that VB.NET does not...).

If that doesn't work, then I'm not sure what else to try.  You'll probably need to zip the project and email it to me so I can take a look at it.
Jeff Pagley
Jeff Pagley
StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)
Group: StrataFrame Users
Posts: 223, Visits: 893
Hi Ben,

I was wandering if you had a chance to look at the zip project I sent you via email with the ApplicationBasePage reference error?

Thanks,

Jeff
StrataFrame Team
S
StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
I PM'd you Jeff.
StrataFrame Team
S
StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
OK, Jeff, it's weird. I don't know how to explain it, but the App_Code folder in that project is broken.  Maybe it's in the wrong project-type or the DevExpress project didn't configure it property; I don't know, but anything in the App_Code folder is broken.  

Any class you place in the App_Code folder cannot be seen by any other code file in the project, and it can't see any of the code (or even references Blink) of the project.  I created a new folder in your project and called it "Code" and moved the ApplicationBasePage to there, and everything started working.  I did have change the inherit line to the full path of the ApplicationBasePage (with namespace) in your Default.aspx.cs file, but that was it.  Just moving the ApplicationBasePage.cs file out of the App_Code folder worked. 

Who would have thunk it.  Strange things are afoot at the Circle-K...
Jeff Pagley
Jeff Pagley
StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)
Group: StrataFrame Users
Posts: 223, Visits: 893
WOW.  That is weird.  I did what you said and it worked.  After all of this, hopefully others can benefit from what we found out.

Thanks,

Jeff
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search