?
Solved

classic asp in .cs class

Posted on 2012-04-03
2
Medium Priority
?
390 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

770 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