Click here to Skip to main content
14,667,145 members
Rate this:
Please Sign up or sign in to vote.
See more:
I am a new bee in In a application there is
a class named "DataAccessLayer.cs" use to connect database.
In another page i.e. index.aspx when i am using...

namespace WebApp 
    public partial class index : System.Web.UI.Page
        DataAccessLayer objDataAccessLayer = new DataAccessLayer(); 
        protected void Page_Load(object sender, EventArgs e)


it runs in my localhost success fully. but it generate error
when i am hosting it.
Error say: CS0246: The type or namespace name 'DataAccessLayer' could not be found (are you missing a using directive or an assembly reference?)

What I have tried:

I have make a class library file in another project and in another solution i add the class library and above project together. then add reference. but all are in vain.
Updated 1-Oct-16 10:27am
Ehsan Sajjad 30-Sep-16 6:44am
have you checked the dll is there which contains the DataAccessLayer implementation?
F-ES Sitecore 30-Sep-16 6:49am
You need to ensure the dll for the class library is in the website's bin folder also.
Member 12759883 30-Sep-16 6:55am
dll is there
Member 12759883 30-Sep-16 7:05am
strange thing is the code is running well in localhost. can anybody plz help. i can send my project
Suvendu Shekhar Giri 30-Sep-16 7:21am
Make sure that your web application refers to(in project references) correct path (relative project path) of the dll. To do that, right click on the reference link and go to properties.

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Follow the instruction from MSDN: Compiler Error CS0246[^] to resolve your issue.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100