How to use the C# or VB.NET code into the coldfusion

Last post 05-27-2009 11:39 AM by vinceb. 5 replies.

Sort Posts:

  • How to use the C# or VB.NET code into the coldfusion

    05-08-2009, 10:49 AM
    • Member
      42 point Member
    • dilip12
    • Member since 04-25-2007, 10:16 PM
    • Posts 197

    Hi,

     

    I am a .Net developer and recently i am working with the coldfusion project with one of the multination company. I am encoraged to give new ideas.

     

    My thougt is---is there any way to use the class files or the pre-compiled .net code to the coldfusion. i want to use most of my coding i.e, core functionality in .net and use only the calls and the html in coldfusion.

     

    Any idea will be greatly appriciated

     

    Thanks in advance

    D

  • Re: How to use the C# or VB.NET code into the coldfusion

    05-15-2009, 1:36 PM
    • Member
      41 point Member
    • vinceb
    • Member since 11-22-2005, 11:27 PM
    • Alpharetta, GA
    • Posts 13

    My company makes a product called BlueDragon.NET that extends ASP.NET to allow it to run ColdFusion (CFML) applications without needing a ColdFusion Server. Yes, by installing BlueDragon.NET, you can run ".cfm" pages directly within ASP.NET. Then you can fully integrate your ColdFusion (CFML) pages with ASP.NET, for example:

    • share application and session scope variables between ".cfm" and ".aspx" pages
    • invoke .NET objects from within CFML pages (which I think answers your original question)
    • invoke CFML components from ASP.NET pages

    There also two documents you might be interested in reviewing:

    BlueDragon.NET is being used by MySpace.com among many other web sites.

    Vince Bonfanti
    New Atlanta Communications, LLC
    http://www.newatlanta.com

    Migrate from ColdFusion to ASP.NET with BlueDragon
  • Re: How to use the C# or VB.NET code into the coldfusion

    05-19-2009, 11:19 AM
    • Member
      42 point Member
    • dilip12
    • Member since 04-25-2007, 10:16 PM
    • Posts 197

    Hi,

     

    Thanks for your reply. You have given me very good example. But i am looking other way around. I want to use the .dll's or the C# code into my Coldfusion code (cfm).

     

    Thanks

    D

     

     

  • Re: How to use the C# or VB.NET code into the coldfusion

    05-19-2009, 11:38 AM
    • Member
      41 point Member
    • vinceb
    • Member since 11-22-2005, 11:27 PM
    • Alpharetta, GA
    • Posts 13

    BlueDragon.NET allows you to create .NET objects and invoke their methods from within CFM pages. For example, the following code creates an instance of System.Collections.Hashtable, adds element "firstName" and then checks for its existence within the Hashtable; the following code would be within a CFM page:

        <cfset ht = createObject( ".net", "System.Collections.Hashtable" )>
        <cfset ht.Add( "firstName", "Vince" )>
    
        <cfif ht.Contains( "firstName" )>
            Hello <cfoutput>#ht.get_Item( "firstName" )#</cfoutput>
        <cfelse>
            Error, "firstName" not found!
        </cfif>

    The CFML "createObject" function or <cfobject> tag can be used to create an instance of any .NET class, whether a built-in framework class or one you've written yourself.

    Is this what you're trying to do? If not, can you give me a more detailed example and I'll try to help you find a solution (I'm sure there is one).

    Vince Bonfanti
    New Atlanta Communications, LLC
    http://www.newatlanta.com

    Migrate from ColdFusion to ASP.NET with BlueDragon
  • Re: How to use the C# or VB.NET code into the coldfusion

    05-27-2009, 9:58 AM
    • Member
      42 point Member
    • dilip12
    • Member since 04-25-2007, 10:16 PM
    • Posts 197

    Thank you so much. How can i use the code for my own custom class.

     

    Any tutorials would be grately helpfu please.

     

    Thank you once again.

     

    D

  • Re: How to use the C# or VB.NET code into the coldfusion

    05-27-2009, 11:39 AM
    • Member
      41 point Member
    • vinceb
    • Member since 11-22-2005, 11:27 PM
    • Alpharetta, GA
    • Posts 13

    If your custom class resides within your ASP.NET webapp, either in an assembly (dll) within your "bin" folder or as source code within the "App_Code" directory, then just put the name of your custom class in place of "System.Collections.Hashtable" in the example I gave. If your custom class resides within an assembly (dll) within the Global Assembly Cache (GAC), then you need to specify the fully-qualified class name, including assembly name, version, etc.

    The only other "trick" to know is that when accessing class properties, you must use .NET IL syntax, not C# property syntax. This is as simple as appending "get_" or "set_" to the property name (which is what the C# compiler does). In the Hashtable example, notice that I access the Item property using "get_Item()".

    You can find more information in Section 4.1.2 of the following document:

    Integrating CFML with ASP.NET

    Just to be clear, this integration of CFML and ASP.NET is only available with BlueDragon.NET and not with Adobe ColdFusion.

     

    Vince Bonfanti
    New Atlanta Communications, LLC
    http://www.newatlanta.com

    Migrate from ColdFusion to ASP.NET with BlueDragon
Page 1 of 1 (6 items)