Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

coldfusion - File Not Found

Posted on 2011-04-20
11
Medium Priority
?
530 Views
Last Modified: 2012-05-11
Hello experts.
I'm using cf8 and mysql.
How can i show a custom page with a file not found message when a user is typing a wrong address in the url ?

(i'm using application.cfm NOT application.cfc)
0
Comment
Question by:Panos
  • 7
  • 4
11 Comments
 
LVL 11

Expert Comment

by:Brijesh Chauhan
ID: 35431619
here is another usefull post

http://www.coldfusionjedi.com/index.cfm/2007/12/5/The-Complete-Guide-to-Adding-Error-Handling-to-Your-ColdFusion-Application

<cffunction name="onError" returnType="void" output="true">
	<cfargument name="exception" required="true">
	<cfargument name="eventname" type="string" required="true">
	<cfset var errortext = "">

	<cflog file="myapperrorlog" text="#arguments.exception.message#">
	
	<cfsavecontent variable="errortext">
	<cfoutput>
	An error occurred: http://#cgi.server_name##cgi.script_name#?#cgi.query_string#<br />
	Time: #dateFormat(now(), "short")# #timeFormat(now(), "short")#<br />
	
	<cfdump var="#arguments.exception#" label="Error">
	<cfdump var="#form#" label="Form">
	<cfdump var="#url#" label="URL">
	
	</cfoutput>
	</cfsavecontent>
	
	<cfmail to="bugs@myproject.com" from="root@myproject.com" subject="Error: #arguments.exception.message#" type="html">
		#errortext#
	</cfmail>
	
	<cflocation url="error.cfm">
	
</cffunction>

Open in new window

0
 
LVL 2

Author Comment

by:Panos
ID: 35431624
Hi brijeshchauhan
I have tried these allready.Nothing happens.
I have no 404 error.
screen.gif
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 2

Author Comment

by:Panos
ID: 35431628
I will check the last one
0
 
LVL 2

Author Comment

by:Panos
ID: 35431652
Is your last post working with application.cfm?
0
 
LVL 2

Author Comment

by:Panos
ID: 35431731
Your last post is handling errors.
I have allready in my application.cfm page error handlers but  that are not catching the error.
(<cferror type="exception" template="#request.absolutepath#errorstop.cfm">
<cferror type="request" template="#request.absolutepath#errorstop.cfm">
<cferror type="validation" template="#request.absolutepath#errorstop.cfm">)
0
 
LVL 11

Expert Comment

by:Brijesh Chauhan
ID: 35431773
have you set up the error template in the ColdFusion administrator ?
0
 
LVL 2

Author Comment

by:Panos
ID: 35431879
No.
I have not set up a  missing template handler in administrator.

i want to use  shared hosting and have a custom page  using my page templates.
Is it not possible?
0
 
LVL 11

Accepted Solution

by:
Brijesh Chauhan earned 2000 total points
ID: 35432812
It works if you add the missing template handler in CF ADMIN, I don't think CFERROR will catch it,  here is what mentioned in DOCS
¦
application: application exceptions.
 
¦
database: database exceptions.
 
¦
template: ColdFusion page exceptions.
 
¦
security: security exceptions.
 
¦
object: object exceptions.
 
¦
missingInclude: missing include file exceptions.
 
¦
expression: expression exceptions.
 
¦
lock: lock exceptions.
 
¦
custom_type: developer-defined exceptions, defined in the cfthrow tag.
 
¦
any: all exception types.



the other way is through ISAPI_REWRITE if you are using IIS or MOD_REWRITE is you are using Apache as web server

0
 
LVL 2

Author Comment

by:Panos
ID: 35433279
OK thank you.
I will look to handle this using the MOD_Rewrite because i'm using Apache.
0
 
LVL 2

Author Closing Comment

by:Panos
ID: 35433290
Thank you.
Regards
Panos
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, I was working on some optimization and spam-stopping techniques when I encountered Ben Nadel's post to reduce spam feature using Math (http://www.bennadel.com/blog/197-How-I-Stop-Spammers-On-My-ColdFusion-Blog.htm). While this method is not o…
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Suggested Courses

580 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