Costas, Mike,

Thanks for your responses.  I was asking in part just to get a conversation
going on the topic.  Your reservations about using this method certainly
make sense to me.

The reason I initially thought of this was that I was unsure whether users
would or would not have cookies enabled, so URL variables became a good way
to maintain state across pages.  But since I will soon be requiring users to
have cookies enabled to access my (intranet) site, I won't have to worry
about that, in which case the session variable option becomes a possibility.

The issues you raise as being problems with such an approach to any problem
are good ones, and make me think that there is no real reason to pursue this
change to the site unless I come across some particular, unavoidable reason
for it.

Thanks again,
Matthieu

-----Original Message-----
From: Tangorre, Michael [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 29, 2002 2:37 PM
To: CF-Talk
Subject: RE: query string variable idea


I agree and disagree with you.

First off, query string variables have a certain level of unreliability. You
would not want to pass sensitive information in the query string or values,
that if changed, would cause negative results or undesired results.
Secondly, it is the coders responsibility to take into account a visitor
changing the query string, and thus accomidating a change.

I don't agree with just resorting to the session scope either. I am guilty
of this in the past, but have found that making use of the request scope has
proven to be a much more efficient way in that you cut down on locking and
the such. Use sessions, but copy the session scoped vars to the request
scope and lock once (application.cfm would be a good place for this).

Also, I would not "set" the variable variables.AppendToQueryString equal to
noQS for the simple reason that if you set this variable to something else
in a subsequent page then make a new request, that variable gets "set" to
noQS again (because application.cfm executes before any other page)...
meaning you never get the variable where you want it anyway.

I could be way off base, but I would rethink what you are trying to pass
around the application and the manner by which you are doing it... see if
you can better organize the way information needs to be passed and really
solve the root of the problem and not "fix" it... it will creep back up on
you down the road. If I am missing what you are saying, post back...

Mike

-----Original Message-----
From: Costas Piliotis [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 29, 2002 2:20 PM
To: CF-Talk
Subject: RE: query string variable idea


Uhm...  There's some problems inherent with using url strings to control
your variables.

First.  Why would you want to use a URL variable instead of a session
variable?  In application.cfm, you could just add:

<cfif isDefined("url.varname">
        <cflock scope="SESSION" timeout="10">
                <cfset session.varname = url.varname>
        </cflock>
</cfif>

Then use session.varname as you see fit.

Second.  Querystring variables are inherently bad to use for anything that's
important.  They are only really useful for saving searches.  Anything
that's even remotely critical is best handled through POST variables or
COOKIES...

Third.  Querystring variables are limited to one dimension values.  Sessions
can store arrays.  

Forth.  Querystrings, until IE 5.5, were limited to 255 characters.  This
limits the amount of variables you can have in a url unless you limit
browsers to IE 5.5 or better.

I have no idea why you would want to do what you are saying...  Perhaps you
could enlighten me as to why and perhaps more people would understand...


-----Original Message-----
From: Cornillon, Matthieu [mailto:[EMAIL PROTECTED]] 
Sent: Monday, July 29, 2002 9:35 AM
To: CF-Talk
Subject: query string variable idea


Hi, there.  In trying to solve a problem this weekend, it occurred to me
that I could easily handle my situation by passing a particular URL variable
with every link on my site.  Unfortunately, that would mean going through
and appending that URL variable to every link on my site, so I ended up
going with a different solution.
 
But then it occurred to me that I might be onto an idea for a future
project.  Why not set up my site so that every link on the site has the
local variable AppendToQueryString added to it.  So, every link would look
like this:
 
<a href="
http://www.mysite.com/subdir/file.cfm#Variables.AppendToQueryString
<http://www.mysite.com/subdir/file.cfm#Variables.AppendToQueryString> #">
 
In the Application.cfm, I set Variables.AppendToQueryString equal to ?noQS.
 
That way, any time that I want to solve a problem by adding a particular
query string variable, I can just add it on to Variables.AppendToQueryString
in the appropriate page.  I can also add things across the site by changing
the default value in Application.cfm.
 
This is all hypothetical: for now, I have no need for it.  But I was
wondering whether taking this infrastructure step is problematic for some
reason, or if there is some established better way of doing it.
 
Any thoughts?
 
Thanks,
Matthieu



______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to