Being that the https is required on every request, having this at the 
top of your constructor makes sense, to prevent processing of the other 
functions should the request be unsecure. I would put the check and 
redirect in a custom function, and call the function in the beginning of 
your constructor.

Steve "Cutter" Blades
Adobe Certified Professional
Advanced Macromedia ColdFusion MX 7 Developer

Co-Author of "Learning Ext JS"
http://www.packtpub.com/learning-ext-js/book
_____________________________
http://blog.cutterscrossing.com

On 6/17/2009 10:02 AM, Dawson, Michael wrote:
> One of the first things I want to do, on each request, is to ensure that
> each request/response is secured.  Therefore, if cgi.https is "off", I
> will redirect the browser to the secured location.
>
> My plan was to put this code in the pseudo-constructor area (not in any
> particular function body):
>
> <cfif len(trim(cgi.query_string)) gt 0>
>      <cfset queryString="?#cgi.query_string#">
> <cfelse>
>      <cfset queryString="">
> </cfif>
>
> <cfif cgi.https is "off">
>      <cflocation
> url="https://#cgi.server_name##cgi.path_info##queryString#";
> addtoken="no" statuscode="301">
> </cfif>
>
> The code works fine, but I'm wondering if it is the wrong place to put
> this code.  Would it be more-semantic if it were located in the
> onRequestStart function?
>
> On this particular site, every page will need to be secured.
>
> Michael Dawson
> Manager of Web Applications
> Office of Technology Services
> University of Evansville
>
> Each time you send an email message with a background pattern
> or loud background color, an endangered tree dies.
> Please help us save a tree. Just say "NO" to email backgrounds.
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:323578
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to