Solved

Type or namespace name 'aspNetEmail' could not be found

Posted on 2004-10-08
3
679 Views
Last Modified: 2007-12-19
I am developing a page in Visual Studio that will send me an email with the comments the user leaves on the page.  To do this I am using a program called aspNetEmail which is a component provided by my hosting company.  However, to use this component in visual studio I have to have the dll (aspNetEmail.dll).  I obtained the dll and added it as a reference to the project, as a solution item, and as an existing item.  All of these produced the same result. ** CS0246: The type or namespace name 'aspNetEmail' could not be found (are you missing a using directive or an assembly reference?)**  Here is the code I am using:

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using aspNetEmail;

namespace MastaGardener
{
      /// <summary>
      /// Summary description for comments.
      /// </summary>
      public class comments : System.Web.UI.Page
      {
            protected System.Web.UI.WebControls.TextBox txtName;
            protected System.Web.UI.WebControls.TextBox txtComments;
            protected System.Web.UI.WebControls.Button btnSubmit;
            protected System.Web.UI.WebControls.TextBox txtEmail;
      
            private void Page_Load(object sender, System.EventArgs e)
            {
                  // Put user code to initialize the page here
            }
      
            #region Web Form Designer generated code
            override protected void OnInit(EventArgs e)
            {
                  //
                  // CODEGEN: This call is required by the ASP.NET Web Form Designer.
                  //
                  InitializeComponent();
                  base.OnInit(e);
            }
            
            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            private void InitializeComponent()
            {    
                  this.btnSubmit.Click += new System.EventHandler(this.btnSubmit_Click);
                  this.Load += new System.EventHandler(this.Page_Load);

            }
            #endregion

            private void btnSubmit_Click(object sender, System.EventArgs e)
            {
                  //EmailMessage msg = new EmailMessage("localhost");
                  aspNetEmail.EmailMessage msg = new aspNetEmail.EmailMessage("localhost");
                  msg.FromAddress = txtEmail.Text;
                  msg.To = "helloworld@aol.com";
                  msg.Subject = "Comments & Suggestions";
                  msg.Body = txtComments.Text;
                  msg.ThrowException= false;
                  if ( msg.Send() )
                  {
                        Response.Write( "message sent!");
                  }
                  else
                  {
                        Response.Write( msg.LastException().Message );
                  }
            }
      }
}

The project rebuilds fine this way without errors, but pitches a fit when I go to view the page.  The other this is that when I type "aspNetEmail." the drop down box appears for me to choose something.  I'm not really sure what is going on.  Help asap appreciated!
0
Comment
Question by:MastaGardener
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 8

Expert Comment

by:Razzie_
ID: 12265676
Do you mean by viewing the page after deploying? So not when starting from VS.NET?

If you mean viewing it not from VS.NET but really 'live', check how the reference is added. Check if the 'copy local' property is set to true. If it is, the aspNetEmail component is copied to your build folder. If it is set to false, it will just create a reference to the path of the dll file. Upon deploying the project on another server or something, this directory may not exist. In fact, the complete component might not even exist when it is not copied to the build folder.

HTH,

Razzie
0
 

Author Comment

by:MastaGardener
ID: 12267016
Hi Razzie

I've got the 'copy local' property set to true.  Right now I'm testing it on IIS on my development computer, not the main server.  So I haven't actually had to move the project to the main server.  Everything has stayed right were it was when I began development.  I view the page in IE.  I've also checked the bin folder to see if the dll was there, and it was after I had set the 'copy local' property to true.

Thanks - Steve
0
 
LVL 9

Accepted Solution

by:
glsac earned 500 total points
ID: 12271420
Hey Steve-

I actually own this component...never had a problem. I would suggest you go here: http://www.advancedintellect.com/forums.aspx
and let Dave field your problem...he gets back to issues really quickly on this product.

BTW...the issue may be more related to the fact that you need this dll installed in the GAC...as I bought this component, it installed it for me in the GAC...you should try the following:

gacutil /i aspNetEmail.dll

to uninstall, just use the /u switch instead of i.
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

623 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