I cannot access class inside ASP.NET Web Application !

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • paulnamroud
    New Member
    • Sep 2006
    • 15

    I cannot access class inside ASP.NET Web Application !

    I cannot access class inside ASP.NET Web Application
    a few seconds ago|LINK

    Hello,

    I start to created a new ASP.NET Web Application with VS 2005.

    I created a sperate folder called "Classes" where I created my first class "CContact".

    Then, I added a page "default.as px" in order to display First name & Last name.

    Unfortunately, I cannot access the class "CContact in the Page_Load() method when I try to type the following code: MyWebApp. ... The only class that i can see is "_Default"

    What i'm doing wrong ?

    Can anyone help me ?

    Thank you

    Paul


    Code:
    // -----------------------------------------------------------
    // Class: CContact.cs
    // -----------------------------------------------------------
    using System;
    using System.Data;
    using System.Configuration;
    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 MyWebApp
    {
        public class CContact
        {
    
            // Constructor
            public CContact()
            {
                
            }
    
            public static string FirstName()
            {
                return "John";
            }
    
            public static string LastName()
            {
                return "Travolta";
            }
    
        }
    }
    
    
    
    // -----------------------------------------------------------
    // ASP.Net Page: default.aspx.cs
    // -----------------------------------------------------------
    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;
    
    using MyWebApp;
    
    namespace MyWebApp
    {
        public partial class _Default : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
               
            }
        }
    }
Working...