Solved

including ASP code in CFM page

Posted on 2002-07-18
10
222 Views
Last Modified: 2013-12-24
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...
0
Comment
Question by:ppollei
  • 3
  • 2
  • 2
  • +3
10 Comments
 
LVL 1

Expert Comment

by:ndintenfass
ID: 7163627
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.

0
 
LVL 17

Expert Comment

by:anandkp
ID: 7164056
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
0
 

Author Comment

by:ppollei
ID: 7164778
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
0
 
LVL 5

Expert Comment

by:CFXPERT
ID: 7185559
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
0
 
LVL 17

Expert Comment

by:anandkp
ID: 7185635
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
0
Superior storage. Superior surveillance.

WD Purple drives are built for 24/7, always-on, high-definition security systems. With support for up to 8 hard drives and 32 cameras, WD Purple drives are optimized for surveillance.

 
LVL 5

Expert Comment

by:CFXPERT
ID: 7192358
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
0
 

Author Comment

by:ppollei
ID: 7201332
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
0
 
LVL 5

Expert Comment

by:CFXPERT
ID: 7201358
Not a problem.

:)
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 10794260
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
0
 
LVL 1

Accepted Solution

by:
GhostMod earned 0 total points
ID: 10819635
PAQed, with points refunded (100)

GhostMod
Community Support Moderator
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now