Click here to Skip to main content
15,886,069 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am a new bee in asp.net. In a asp.net application there is
a class named "DataAccessLayer.cs" use to connect database.
In another page i.e. index.aspx when i am using...

C#
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.
Posted
Updated 1-Oct-16 10:27am
v2
Comments
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

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

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900