Link to home
Start Free TrialLog in
Avatar of ppollei
ppollei

asked on

including ASP code in CFM page

I have several pages I am trying to do a quick conversion on.  I want to keep the <% tags until I get time to rewrite the code.  Every time I put the code in the page, it ends the execution of the page.  If I put it as an include file I get a "Just in time compilation error".  Are there any quick solutions for getting the ColdFusion Server to read the code?

Pages with VBscript are working great with this until it hits the ASP code.

Thanks in advance...
Avatar of ndintenfass
ndintenfass

ColdFusion should just ignore most ASP tags.  Though, it could be you have # signs causing problems.  Can you post a code sample that is breaking CF?

If you want the code to actually execute you will need to either use CFOBJECT (not suggested) or use CFHTTP to call the ASP page from the CF page and output the results.

Hi there,

why r u having pages with halp asp & half CF code.

do one things .. conver ur pages one at a time.

so lets say u have 2 pages in ASP

page1.asp & page2.asp

convert page1.asp completely into page1.cfm

& pass the same paramters from page1.cfm to page2.asp as page1.asp was sending initially.

so ur transition aslo works fine & so does ur site.

this is what i had done for my last project & it didint give me ne-probs, as CFM code was processed by CF server & asp code by ASP.DLL.

so thigns were cool

try & let me know

K'Rgds
Anand
Avatar of ppollei

ASKER

Ndintenfass and Anand,

A few comments here.  I have named all the pages I am working with to *.cfm and began the convertion process.  I have changed all the include commands to be called by "cfinclude"  Most of the pages are working, but I have some that have ASP Script after I do the includes.  The pages will execute, but nothing after the ASP script is executed.  Here is an example of the code:

<cfinclude template="doc_header.cfm">

<%
Dim intpr
Dim RstPR
set rstpr = server.createobject("adodb.recordset")
set rstActivities = server.createobject("adodb.recordset")
set rstActivities = cnncontracting.execute ("select ActivityID,Name from tblactivities order by name")
set rstBusSize = server.createobject("adodb.recordset")
set rstCompete = server.createobject("adodb.recordset")
set rstbussize = cnngivenname.execute("select x, y from tblxy order by z")
set rstcompete = cnngivenname.execute("select a, b from tblabc order by a")
set rstfy = server.createobject("adodb.recordset")
set rstfy = cnncontracting.execute ("select fy from tblfy")
%>

<script language="vbscript">
Sub LookupCS()
If len(pr.txtxy.value) > 0 then
     strname = pr.txtxy.value

When I include the ASP script in the file it shows no errors, if I write the asp code to a seperate file and do a cfinclude I get a "just in time compilation error".

As far as converting the pages, that is definately in the plan.  These pages were originally written by a contractor and we need them to be integrated into our current system.  I am trying to get the system running as quickly as possible and was looking for a shortcut.  I am going to look into using the CFSCRIPT.  I am not sure CFHTTP will work for the situation I have.  If I don't find a fairly quick solution I will just start the conversion.  Unfortunately that will take me a while and I am attempting to complete this portion this week.

Hope this helps some, thanks for the comments.

PSP
When you include the asp script in the cold fusion code it works because it's calling an ASP page with an ASP file extension.  When you hard code the same code into the cold fusion script, it aborts when it hits the asp code because Cold Fusion Server cannot figure out what it is exactly.  This seems to be what's happening.  I know too well the headache of converting asp to cold fusion.  It's a long drawn out process and unfortunately there's no way around it.  Good luck to ya though.

:)
KWK
Hi there,

u said - "When I include the ASP script in the file it shows no errors, if I write the asp code to a seperate file and do a cfinclude I get a "just in time compilation error"."

how can u have a asp file included in a cf file - thru cf include.

i think what u need to do is go with the conversion process - very slowly & carefully.

convert file by file & not all of them at once. ie to say ... convert all the code in a asp file to CFM ... no matter what it is - but everything in a CF file should be CF code & not asp [reason as given by CFXPERT]

& then move ahead with this

All the best,

K'Rgds
Anand
The bottom line is that you cannot hard code ASP into a CFM file and expect wnything to work properly.  You'll need to fully convert this code before you can expect it to work the way you need.

:)

KWK
Avatar of ppollei

ASKER

Thank you for the information.  I have come to the conclusion that I will have to redo the code on each page.  Since this is a non-solution to the question I will be removing the question from the system.

Thanks once again.
PSP
Not a problem.

:)
No comment has been added lately, so it's time to clean up this question.
I will leave the following recommendation in the Cleanup topic area:

Split CFEXPERT & anandkp

Please leave any comments here within the next four days.

mrichmon
EE Cleanup Volunteer
ASKER CERTIFIED SOLUTION
Avatar of GhostMod
GhostMod
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial