Click here to Skip to main content
15,893,588 members
Articles / Programming Languages / VBScript

.NET COM+ Interop Component with Classic ASP (Part I)

Rate me:
Please Sign up or sign in to vote.
4.80/5 (14 votes)
25 Sep 2008CPOL8 min read 160.5K   1.7K   46  
Call a .NET COM+ Interop component with Classic ASP.
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Runtime.InteropServices;
using System.EnterpriseServices;


using log4net;
using log4net.Config;

[assembly: ApplicationName("JayTest")]
[assembly: Description("Jay Test business layer com+")]
[assembly: ApplicationActivation(ActivationOption.Server)]
[assembly: ApplicationAccessControl(false, AccessChecksLevel = AccessChecksLevelOption.ApplicationComponent)]
namespace busLayer 
{
    [GuidAttribute("ADF0D549-D84B-422c-A15E-5B22C1E35FB5")]
    public class JayClass :ServicedComponent
    {
        private static readonly ILog log = LogManager.GetLogger("ErrorLogger");


        public JayClass()
        {
            FileInfo fi = new FileInfo(@"C:\Temp\Logging\busLayer\app.config");
            log4net.Config.XmlConfigurator.ConfigureAndWatch(fi);
        }

        public string MyLog(string message)
        {
                if (log.IsDebugEnabled)
                    log.Debug(message);
                if (log.IsWarnEnabled)
                    log.Warn("warn " + message);
                if (log.IsErrorEnabled)
                    log.Error("error " + message);
                return message;

        }

        public string MyLogi(string message, int i, DateTime d, decimal dec)
        {
            for (int j = 0; j < i; j++)
            {
                if (log.IsDebugEnabled)
                    log.Debug("debug " + message);
                if (log.IsWarnEnabled)
                    log.Warn("warn " + message);
                if (log.IsErrorEnabled)
                    log.Error("error " + message);
            }
            return message + i.ToString();

        }

 
        public string MyLogs(string message, string i)
        {
               if (log.IsDebugEnabled)
                    log.Debug(message);
                if (log.IsWarnEnabled)
                    log.Warn("warn " + message);
                if (log.IsErrorEnabled)
                    log.Error("error " + message);
                return message + i;
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect
United States United States
I am a software architect/developer, having 15 years of design/development experience. Currently working in large financial corporation, architecting .NET applications and coding using C#, ASP.NET, Java Script etc..

MS Computers, MCP, MCTS: .NET Framework 2.0 Web Applications.

Comments and Discussions