This is an example that I used when demonstrating ColdFusion 8 .NET integration on the recent usergroup tour, and as requested, I am posting it publicly. GetDriveInfo() returns a query containing specifics about the hard drives on your server, it returns all drives unless an optional drive letter is passed to it. GetDriveInfo() uses the .NET System.IO.DriveInfo class (which was introduced in .NET 2, and thus this example requires .NET 2 or 3).
Here is the code:

And here is a simple test example:

All Drives

C: Drive

Free Space On C Drive

7 thoughts

  1. So I get that we can call .net code from cf, but can it work the other way around? Can someone in .net call some code that I write in CF through the same pipes?

  2. Why not let Microsoft build the capability to invoke CF component from .NET šŸ˜‰
    On a serious note, I think the only way to do that currently is through webservices.

  3. Ha, I can see microsoft jumping at that chance… I can see the marketing now….
    If you invest in .net, you can do your heavy lifting in coldfusion!
    Seriously, thanks for your work on all of this guys, I can live with webservices for a little while longer, but here’s hoping for CF 9! šŸ˜‰

  4. Anyone know if there is a TCP/IP .Net assembly? I’m look to send a tcp/ip message to a server and receive a response from the server.

Leave a Reply