Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   ASP.NET (http://www.programmingforums.org/forum35.html)
-   -   accessing classes in app_code folder (http://www.programmingforums.org/showthread.php?t=15582)

paulchwd Apr 9th, 2008 8:04 PM

accessing classes in app_code folder
 
Hello All,I cant figure it out:
I started a new asp.net web application in VS Pro 2005 (herein referenced as VS2005P) and added a folder named App_code (by right clicking on the project). It looks like VS2005P was ok with it as it changed the icon for the folder to a gray folder with a thing on it.



I right clicked and added classes, but when I tried to instantiate those classes from my .aspx files it doesnt recognize them i get that error "type or namespace could not be found....."



**note the code in app_code are my business objects not my code behinds. code behinds are with the .aspx files



code for business class in app_code written by VS2005P:
:

namespace PropertyPhotos
{
  namespace PropertyPhotos.App_Code
  {
      public class Photos
      {
           
          ....... code
      }

  }
}


I tried getting rid of the ".app_code" from the namespace, but no work still:
:

namespace PropertyPhotos
{
    public class Photos
    {
        private string _errorMessage = "";
        private string _thumbsDIR_base = Util.readFromWebConfig("thumbsDIR_base");
        private string _fullSizeDIR_base = Util.readFromWebConfig("fullSizeDIR_base");
    }
}


Here is my .aspx code - this is where i get the error:
:

namespace PropertyPhotos
{
    public partial class propertyPhotos : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //string propertyID = Request.QueryString["pid"];
            string propertyID = "1234";

            Photos photos = new Photos(propertyID);
              .... more code
        }
    }
}


The error:
:

Error        1        The type or namespace name 'Photos' could not be found (are you missing a using directive or an assembly reference?)        E:\.....\Visual Studio 2005\Projects\C21k\PropertyPhotos\PropertyPhotos\PropertyPhotos\propertyPhotos.aspx.cs

paulchwd Apr 9th, 2008 8:25 PM

Re: accessing classes in app_code folder
 
Fixed. It turns out that the properties for each of the files in my app_code folder had build action set to content and not compile. Thnx


All times are GMT -5. The time now is 4:03 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC