Solved

Type or namespace name 'aspNetEmail' could not be found

Posted on 2004-10-08
3
676 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
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

685 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