> I have a variable in a struct called session.auth that is related to
the id
> of the article the user is seeing.  If the variable
#session.auth.100824#
> exists, the user can visit article 100824 otherwise he's denied
access.
>
> How can I check that this variable exists?   I have tried the
following and
> it throws an error, saying that isdefined has to have a syntactically
valid
> variable name:
>
> Where did I get it wrong please?
>
> Here's what I've put that throws an error:
>
> <cfif isdefined("Session.auth[#articleid#]")>
> you're in
> <cfelse>
> you're out
> </cfif>

Instead of using isDefined() on a key, you should use StructKeyExists()

<cfif StructKeyExists(Session.auth, articleID)>

That should do what you want

HTH



[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to