Posts

Showing posts from May, 2008

CFSchedule task - how to schedule a job in ColdFusion 7

This article will show how to schedule an automated job in ColdFusion 7 using CF administrator.

Login to CF 7 Administrator and from left hand side, under Debugging & Logging, select Scheduled Tasks Option. Select create new.

Under task name enter a task name, start date enter the date from which you want to start scheduled task, you could set daily or monthly depending on your preference and make sure specify time, in my case i entered 9:00 AM, under URL I entered my url like this,
http://myipaddress/MonthlyReport - DontDelete/R_monthlyreport.cfm where
MonthlyReport - DontDelete is a folder to make sure our report runs without any authentication that is usually specified in Root/Application.cfm. Instead of IPAddress, you could enter a url to a site as well but make sure you have right permissions.

Finally, you could do save output to file and make sure specify the path to output file like this C:\Inetpub\wwwroot\clientname\MonthlyReport - Dont Delete\RepOut.htm

Thats all, and you …

Coldfusion 7 - Accessing images from a network share

So this morning I had an issue where in images were not being displayed. The images are stored on network share on a different machine.

I used this code to make it work, thanks to the help provided by http://www.acfug.org/ members.

welcome to the test page.....
<cfset theFile = "\\servername\sharename\CF_Chart_Share\test.jpg">

<cfif fileExists(theFile)>

File exists

<cfelse> does not exist

</cfif>

<br><cfoutput>#theFile#</cfoutput> <br>

<!--- we have code in img2.cfm that will get us the image -->
<br><img src="img2.cfm">

The file img2.cfm has the code below

<cfcontent type="image/GIF" file="\\servername\sharename\CF_Chart_Share\test.jpg">

I tried adding the code cfcontent in the same page but that was causing only the image to be displayed i.e. no text was being displayed.

Hope it helps someone.

Ajas.

Webex file extension .wrf will not open or rendered by IIS web server

We recently moved our web application to new server and we noticed that the webex files with extension .wrf was not being shown to user or was not being rendered by IIS. So on doing further research, I came to know that we needed to set a MIME type for the wrf extension. The .wrf extension needs to be set to application/octet-stream.

Go to IIS settings, select the website or the web root folder and right click and select properties. Click on HTTP Headers tab and the bottom click on MIME Types button. Click new button and add .wrf in extension and application/octet-stream in MIME Type text box. Click OK and Apply at next screen and you should be done.

After I clicked OK and Apply, the screen Inheritance override was shown. I said cancel to all. Here is some info from IIS help.
If you set or change a MIME type that conflicts with a setting at another node in the hierarchy, you are prompted with an Inheritance Override dialog box where you can specify the nodes to which the new setting ap…

Redirect using Coldfusion or Redirect using IIS

Image
I have a client who has url say www.xyz.com. They want a new url www.abc.com so that when user enters www.xyz.com, the user should see www.abc.com in his address bar of browser. Basically an alias/redirection with address bar showing the new url. I could have done redirection by dns names/url redirection at website level but problem is I have a subfolder application i.e. www.xyz.com/subapp.

Now if I do dns/url redirection, and user tries to access subfolder application with this url, www.xyz.com/subapp/home.cfm, it takes the user automatically to www.abc.com/home.cfm i.e. the main application without the subfolder application, and I dont want that. It should take user to www.abc.com/subfolder/home.cfm.

So to avoid this redirection at the website level, I added this code in Application.cfm

Code:
<!-- Relocate if not a secure connection -->
<cfif cgi.SERVER_PORT is "80" and CGI.SERVER_PORT_SECURE is "0">

<!---replace xyz with abc --->
<cfset x = "…