Solved

classic asp in .cs class

Posted on 2012-04-03
2
378 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
Comment Utility
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
Comment Utility
That does not answer fully..I need to know how to code the exposed class in classic asp
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/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 shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

728 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

12 Experts available now in Live!

Get 1:1 Help Now