Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Does CFError Work For Links

Status
Not open for further replies.

scripter73

Programmer
Apr 18, 2001
421
0
0
US
Hi,

Suppose I have a normal link, and if that link doesn't exist, I want to show user an "exception" message. Is this possible?

<CFTRY>
<CFINCLUDE TEMPLATE=&quot;error_handling_template.cfm&quot;>
<a href=&quot;non_existent_link.cfm&quot;>Link Doesn't Exist</a>
<CFCATCH TYPE=&quot;Any&quot;>
Do something here.
</CFCATCH>
</CFTRY>

I'm sort of new to the exception handling and have not done it in real detail. I'm trying to enter the major leagues. :)

Any help is appreciated.

Thanks,
scripter73

 
ColdFusion can't validate a link like that, but you can set up custom 404 pages for your web server. This custom page would have to be a plain html page, but you can still set it up to be helpful to the user.

If you have links to other sites, a better solution would be to periodically run a link validation routine. There's several on the site. One to check out is CF_CheckLink. DarkMan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top