Solved

Type or namespace name 'aspNetEmail' could not be found

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

762 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now