the really bad thing about using cfabort is that EVERYTHING after it stops
processing. So if you code like I do where I put my footer in the
onrequestend.cfm file, well gues what, your footer doesn't process.
Personally I just set a variable called variables.ErrorCode equal to 0. Then
during error checking, if an error occurs, I set it to 1. Now all I have to
do is use some cfifs to see what I want to execute. Plus my footer comes up.
;)

Anthony Petruzzi
Webmaster
954-321-4703
[EMAIL PROTECTED]
http://www.sheriff.org


-----Original Message-----
From: Seth Petry-Johnson [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 23, 2002 11:37 AM
To: CF-Talk
Subject: Re: page security using <cfabort>


> You could always put in the necessary closing tags before the CFABORT...

The main drawback to doing this approach is that it leads to cluttered code,
especially if there is complex HTML code contained in your page footer.
Also, consider a situation where there needs to be more than one security
check:

<CFIF NOT condition1>
    Sorry, you're not authorized for this.
    <!-- closing HTML tags here -->
    <CFABORT>
<CFELSEIF NOT condition 2>
    Sorry, you're only authorized for this on Mondays.
    <!-- closing HTML tags here -->
    <CFABORT>
<CFELSEIF NOT condition 3>
    Sorry, you're only authorized for this on Tuesdays.
    <!-- closing HTML tags here -->
    <CFABORT>
</CFIF>

This can become quite messy and is hard to maintain with closing tags
scattered all around the page.

Your best bet is to create a standard "not authorized" page and just do a
CFLOCATION to it when needed.  I usually add a CFABORT just after the
CFLOCATION in case, for some reason, the browser ignores the client side
redirect.  It looks like this:

<CFIF NOT condition1>
    <CFLOCATION URL="not_authorized.cfm">
    <CFABORT>
<CFELSEIF NOT condition 2>
    <CFLOCATION URL="not_authorized.cfm">
    <CFABORT>
<CFELSEIF NOT condition 3>
    <CFLOCATION URL="not_authorized.cfm">
    <CFABORT>
</CFIF>

Regards,
Seth Petry-Johnson
Argo Enterprise and Associates


______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to