In the age of .NET managed code, it is very much painful to write code in Classic ASP. But you have to face such a situation for giving support in old classic ASP application where you cannot get .NET Framework facilities by default. In this post I want to explain how you get all .NET facilities in classic ASP pages. Here I will use C# as a .NET language.
Step for Get it Done
- Lets consider you are working on the directory E:\work\rd
- write a C#.NET application in the MyTest.cs file which will do a multiplication
- Now add the following namespace into your program file MyTest.cs
using System.EnterpriseServices;
using System.Runtime.InteropServices;
- Also add the following name space for strong key
using System.Reflection; using System.Runtime.Co
using System.Reflection; using System.Runtime.CompilerServices;
Add for following assembly information into the Mytest.cs. here MyClass is used as name u can give any name u want . [I will discuss about “key.snk” after completing the MyTest.cs]
[assembly: ApplicationName("MyClass")]
[assembly: ApplicationActivation(ActivationOption.Server)]
[assembly: ApplicationAccessControl(false,AccessChecksLevel=
AccessChecksLevelOption.ApplicationComponent)]
[assembly: AssemblyKeyFile("key.snk")]
- Now the write a method into your class with do multiplication operation
namespace erpbd.Library
{
public class TestApp
{
public string Multiply(int x, int y)
{
return "The result is :" + (x * y);
}
}
}
complete code is given in “RD_CODES.zip”
- SNK is a Strong name utility. We have to create a “key.snk”. consider that visual studio 2005 is installed in your pc go to start>all programs>Visual studio 2005>visual stdion command prompt . now go to your working direcrory then write the command sn –k key.snk [follow the snapshot]

- Now you have to make dll file with the following command csc /target:library /out:ErpLib.DLL MyTest.cs ( if you got any warning then ingnore it )
- Now you have to make a tlb file with the following command regasm "E:\work\rd\ErpLib.DLL" /tlb /codebase Step 7 and 8 is displayed in following snapshot

- write a ASP page which will contain the flowing VBScript code
- Now browser the ASP page from your browser then you will get the following output.
