Solved

classic asp in .cs class

Posted on 2012-04-03
2
386 Views
Last Modified: 2012-04-30
I have the following codes saved as EmailGenerator.cs inside of App_Code folder.
Now I need to use classic asp to call EmailGenerator to do some works.

How to code in classic asp if I want to call the class, EmailGenerator?

Thanks

/// <summary>
/// Summary description for EmailGenerator
/// </summary>
public class EmailGenerator
{
    private string mFromEmail;
    private string mToEmail;
    private string mSubject;
    private string mBody;
    private string mFooter;
    public string FromEmail
    {
        get { return mFromEmail; }
        set { mFromEmail = value; }
    }
    public string ToEmail
    {
        get { return mToEmail; }
        set { mToEmail = value; }
    }
    public string Subject
    {
        get { return mSubject; }
        set { mSubject = value; }
    }
    public string Body
    {
        get { return mBody; }
        set { mBody = value; }
    }
    public string Footer
    {
        get { return mFooter; }
        set { mFooter = value; }
    }
    public string SendeMail()
    {
        try
        {
            MailMessage MessageInfo = new MailMessage(mFromEmail, mToEmail, mSubject, mBody);
            MessageInfo.IsBodyHtml = true;
            SmtpClient EmailClient = new SmtpClient("mail.yyy.com");
            System.Net.NetworkCredential SMTPUserInfo = new System.Net.NetworkCredential("yyy@SolutionOnce.com", "yyy");
            EmailClient.UseDefaultCredentials = false;
            EmailClient.Credentials = SMTPUserInfo;
            EmailClient.Send(MessageInfo);
            return "Send";
        }
        catch
        {
            return "Unable to send email";
        }

    }
}
0
Comment
Question by:Webboy2008
2 Comments
 
LVL 23

Accepted Solution

by:
wdosanjos earned 500 total points
ID: 37802672
You need to expose your C# class as a COM object in order for it to be available to Classic ASP.  Please refer to the link below for details:

Example COM Class (C# Programming Guide)
http://msdn.microsoft.com/en-us/library/c3fd4a20.aspx
0
 

Author Comment

by:Webboy2008
ID: 37803570
That does not answer fully..I need to know how to code the exposed class in classic asp
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

749 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