How to reference to a custom class library

Posted on 2007-09-27
Medium Priority
Last Modified: 2008-09-12

I've created a C# class library and compiled into a DLL. Here is the code -

            using System;

            /// <summary>
            /// Summary description for DateReturn
            /// </summary>
            namespace weborb.tests
                public class DateReturn
                    public DateTime echoDate(DateTime date)
                        return date;

Simple class to return the date.

All i want to do now is check that this is working. So i've added a reference in visual studio, and added the following line in my web.config -

          <add tagPrefix="weborb" namespace="weborb.tests" assembly="DateReturn"/>

How do reference to this in my default.aspx.cs codebehind file? When i run the application it gives me an error stating -
"The type or namespace name 'ClassLibrary1' could not be found (are you missing a using directive or an assembly reference?)"

here is my default.aspx.cs file -

            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 RemotingTestProject
                public partial class _Default : System.Web.UI.Page
                    protected void Page_Load(object sender, EventArgs e)

                        ClassLibrary1 objDate = new ClassLibrary1();

Look forward to your replies.

Question by:Fracture
1 Comment
LVL 21

Accepted Solution

surajguptha earned 2000 total points
ID: 19975768
Date return is ur class not a method. Here is the way to use it

                    protected void Page_Load(object sender, EventArgs e)
                        weborb.tests.DateReturn objDate = new weborb.tests.DateReturn();

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
There may be issues when you are trying to access Outlook or send & receive emails or due to Outlook crash which leads to corrupt or damaged PST file. To eliminate the corruption from your PST file, you need to repair the corrupt Outlook PST file. U…
Suggested Courses

612 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question