Yesterday I sent this message to CF-talk regarding using ASP code in CF
templates. I overlooked one particular aspect regarding redirects. I forgot
about the CFLOCATION tag and by using this the <CFOUPUT>javascript
redirect</CFOUTPUT> becomes unneccessary. So, in the last two lines of the
code below you could substitute the <CFHTTP> and <CFOUTPUT> tags with the
following:

<CFLOCATION URL="http://www.domain.com/aspfile.asp">

Leong

-----Original Message-----
From: Leong Yew [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 10, 2000 10:26 AM
To: [EMAIL PROTECTED]
Subject: RE: Anyone using ASP in a CFM file???


Nancy,

I'm not sure what you hope to achieve here. Are you trying to embed ASP code
in your CF template and get the CF server to parse that code and perform
actions on it? This can't be done directly. CF won't recognize that code and
the processed CF template will be sent to the browser with the asp code
intact.

Sometime ago, on this discussion list, there was similar question. I've
thought about it and there is an indirect way to use ColdFusion to
"pre-process" other server side scripts like ASP or PHP. You'll have to use
a combination of CFFILE (or CFFTP) and CFHTTP. The trick is to get CF to
process and save a text string as the respective server side script and then
use CFHTTP to request for that file.

Here's an example. Suppose you want CF to process a form data but (for some
reason) you want the output to be asp.

<!-- use CF tags to perform whatever actions on say, form.variable. The
result is variable2 -->

<!-- You want to use asp's response.write method to output variable2 -->
<CFSET aspfile = "<% response.write "#variable2#" %>" >
<CFFILE ACTION="write" file="d:/dirpath/aspfile.asp" output="#aspfile#">
<CFHTTP URL="http://www.domain.com/aspfile.asp" method="get"></cfhttp>
<cfoutput>#cfhttp.FileContent#</cfoutput>

Alternatively you could use CFFTP if you want to upload the file to a remote
server. Of course this is just an example and you could do more complex
things with it. Note that the page sent back to the browser will be a CFM
page. If you want to leave CF and get IIS to directly return aspfile.asp to
the browser, you'll have to place the above code within the html document
header, replace <CFHTTP> with <CFOUPUT></CFOUPUT> and nest a javascript
redirect within those tags.

By the way, there might be a problem with the quotes (3rd line) in front of
#variable#. You'll probably have to escape that or use the chr() function. I
can't remember what the value is for that. But this generally is the idea
behind it.

Leong


-----Original Message-----
From: Silverstein, Nancy [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 10, 2000 4:30 AM
To: '[EMAIL PROTECTED]'
Subject: Anyone using ASP in a CFM file???


Can anyone tell me how to get my asp code to run in a CFM file?

Nancy Silverstein
Web Developer
Cooley Godward, LLP
phone 415.693.2714
fax 415.693.2915
[EMAIL PROTECTED]



=======================================================
This email message is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. Any unauthorized review,
use, disclosure or distribution is prohibited.  If you are not the intended
recipient, please contact the sender by reply email and destroy all copies
of the original message


----------------------------------------------------------------------------
--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.

------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to