Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 685
  • Last Modified:

Type or namespace name 'aspNetEmail' could not be found

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
MastaGardener
Asked:
MastaGardener
1 Solution
 
Razzie_Commented:
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
 
MastaGardenerAuthor Commented:
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
 
glsacCommented:
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now