Coldfusion & .Net Integeration

This is a sample code snippet for Coldfusion and .Net intgeration

To access the .net methods first we need to create an object for the .Net  Class , after creating the object we can access the methods in that class . Following is a sample code snippet for accessing the .net methods from coldfusion

Steps to work on the samples
Step 1 Copy the Access MDB file into the “D:\LEarning\CFDotNet\Northwind.mdb”

Step 2 Create the .Net Class Library in Visual studio 2005 , below is the code snippet

// This Code is developed in .net 2005
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Collections;
using System.Data;
using System.Data.OleDb;
using System.Data.SqlClient;
public class CfSample{
public CfSample()
public int SampAdding(int a, int b)
int c;
c = a + b;
return c;
public int SampSubtract(int a, int b)
int c;
c = a - b;
return c;
public int SampMultiply(int a, int b)
int c;
c = a * b;
return c;
public DataTable ACCdatasetMethod()
//conn string
string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\\LEarning\\CFDotNet\\Northwind.mdb" ;
using (OleDbConnection connection = new OleDbConnection(connectionString))
OleDbCommand cmd = new OleDbCommand(@"SELECT [EmployeeID], [LastName], [FirstName], [Title], [City], [Address], [HireDate], [BirthDate], [TitleOfCourtesy], [Region], [PostalCode], [Country], [HomePhone] FROM [Employees]", connection);
OleDbDataReader reader = cmd.ExecuteReader();
DataTable dt = new DataTable();
return dt;

Step 3 Compile the Visual studio solution

Step 4 Copy the generated DLL file in any path or can use the same path where it got generated

Step 5 Call the .Net method in Coldfusion

type = “dotnet”
name = “MDBDTable”
class = “CfSample”
assembly = “D:/vishnu/CfSample.dll”>
<cfset query11 = MDBDTable.ACCdatasetMethod()>
<cfdump var=”#query11#”>

Please get the sample files from the location


32 thoughts on “Coldfusion & .Net Integeration

  1. Hi Todd Rafferty

    AS a start i am working on creating APi for taking screenshot of the current window , and save as image in desktop

    Once that is done will post the same in this blog

  2. Hello Sir,
    the example is working fine in CF 8 and Visual studio 2005 ,but not in in Visual studio 2003 . It shows the error Class CfSample not found in the specified assembly list. The assembly that contains the class must be provided to the assembly attribute . Please give your suggestion and is it possible o integrate CF8 and Visual studio 2003 .Its urgent .


  3. Hi
    yes it possible to integrate CF 8 with VS2003 , i have sent you the steps to this email id arindam_parida(st)(rediffmail)(dot)(com)

    what is ur contact number

  4. I created a.NET 1.1 dll using your specified logic but it throws error when I callled the .Net dll from CF8.
    “It shows the error Class CfSample not found in the specified assembly list. The assembly that contains the class must be provided to the assembly attribute .”

    Do I have to change the settings to integrate CF8 with .Net1.1
    Your example is working fine with .net 2.0 dll.
    In CF8 documents, it says CF8 can be integarted with .net 1.x, 2.x and 3.x

    Please reply soon. Its urgent

  5. Hi

    Have u delete the old DLL and stop the coldfusion 8 .Net service and move the new DLL
    If you have done those steps , it will work fine .

    r u online in yahoo or Gtalk , if yes u can add me , i can guide u the steps that needs to be followed

    Gtalk : wrvishnu
    yahoo :

  6. yes I have done all mentioned steps.

    Delete the old dll.
    Uninstalled .Net2.0 framework,
    then Installed .net1.1 framework
    then installed services.
    restarted the system
    Still getting same error:(
    Iam online on gmail and have given invitation for chat to u.


  7. Hi,
    can we pass xml from ColdFusion to .net ? If yes please give an example . My first problem connection with CF to .Net 2003 is solved .


  8. DO you want to pass XML from Coldfusion to .Net or
    .Net to Coldfusion

    What is your contact number
    DO u have Gtalk or yahoo messenger
    If yes whats ur id
    yahoo IM
    Gtalk :

  9. Hi,
    I want to pass xml from CF to .net . I am new in CF . So please
    give an example how to pass xml from CF to .net . I don’t have Gtalk ar yahoo messanger . You can give the example in my rediff
    id .


  10. After a good amount of trial and error, we have been able to pull back data from a simple .NET class. The problem that we seem to be having is that unless the .NET connectionString is hardcoded into the class then it won’t seem to work.

    The connectionString is refered thus:

    string connectionString = ConfigurationManager.AppSettings[“sqlDatabaseServer”];

    Do you (or anyone else) know if we can use the referenced connectionString or if it has to be hardcoded into the class


  11. Hi
    So far i have tried only using hardcored values , can you try to pass the connection string values a parameter from cf8 to .Net

  12. Class not found in the specified assembly list.

    Has this bug / problem been identified? I am getting it and googled to find nothing that can help the situation.

    It works fine if it is run on the same machine VS 2008 is on, but will not work on the server it is intended for:-(

  13. Hi,

    Using the example I am trying to access a dll in coldfusion but it throws me an error saying “The assembly that contains the class must be provided to the assembly attribute.” I am using CF8 server.

    I am not sure what is wrong.

    Can any one please help me with it.


  14. Very nice post. I just stumbled upon your blog and wished
    to say that I’ve truly enjoyed surfing around your blog posts. After all I’ll
    be subscribing to your rss feed and I hope you write again soon!

  15. Today, I went to the beach with my children. I found a sea shell and gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.” She put the shell to her ear
    and screamed. There was a hermit crab inside
    and it pinched her ear. She never wants to go back!
    LoL I know this is entirely off topic but I had to tell someone!

  16. Thanks for any other informative site. The place else could I get that
    type of information written in such an ideal means? I have a challenge that I am simply now running on,
    and I’ve been at the look out for such information.

  17. Hello everyone, it’s my first visit at this website, and paragraph is actually
    fruitful in support of me, keep up posting these types of content.

  18. Right here is the right site for everyone who would like to understand this
    topic. You understand so much its almost hard to
    argue with you (not that I personally will need to…HaHa).
    You certainly put a new spin on a subject which has been discussed
    for ages. Great stuff, just wonderful!

  19. I do not know whether it’s just me or if everybody else
    experiencing problems with your website. It looks like some of the text within your content are running off the screen. Can somebody else please comment and let me know if this is happening to them
    as well? This might be a issue with my internet browser because I’ve had this happen previously.

  20. Epígrafe 653.2.- Comercio al por menor de material y aparatos eléctricos, electrónicos, electrodomésticos y otros aparatos de uso doméstico accionados por otro tipo de energía distinta de la eléctrica, así como de muebles de cocina. Epígrafe 653.3.- Comercio al por menor de artículos de menaje, ferretería, adorno, regalo reclamo (incluyendo bisutería y pequeños electrodomésticos).

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s