[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

classic asp in .cs class

Posted on 2012-04-03
2
Medium Priority
?
396 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 2000 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

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

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

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Loops Section Overview
Suggested Courses

834 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