Application object disobedience!

Results 1 to 3 of 3

Thread: Application object disobedience!

  1. #1
    Tobeee Guest

    Default Application object disobedience!

    *<BR>Hi – I’m trying to use an Application object “AppObj” to hold the value (STD for normal person privileges, and ADMIN for access to extra secret info!) of a variable ‘Var’<BR><BR>In file1 BODY…<BR><BR>Access for&#060;A HREF = http://file2.asp?Var=STD&#062;normal person&#060;/A&#062;<BR><BR><BR>Access for&#060;A HREF = http://file2.asp?Var=ADMIN&#062;administrator&#060;/A&#062;<BR><BR><BR>In file2 HEAD…<BR><BR>&#060;%<BR>If (Var)=STD Then<BR> Application.Lock<BR> Application("AppObj") = "STD"<BR> Application.Unlock<BR>Else<BR> Application.Lock<BR> Application("AppObj") = "ADMIN"<BR> Application.Unlock<BR>End If<BR><BR>Response.Write Application("AppObj")<BR>%&#062;<BR>… MAIN PROBLEM HERE!!! … this Response.Write output (just included as a check) always displays the value checked by the first part of the If statement – in the above case, STD, even if ‘administrator’ is selected in the first file.<BR><BR>In file3 HEAD…(just for info)<BR> If Application("AppObj") = "STD" Then … .. other outputs etc<BR><BR>Any help would, as always, protect the people closest to me!! Thanks.<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Application object disobedience!

    you can&#039t use an application object to give one person more privelige than another anyway, since everyone viewing the site has access to the same variable. <BR><BR>use session object, if you must<BR><BR>jason

  3. #3
    Join Date
    Dec 1969

    Default Likely very wrong code...

    Atrax is right. You are screwing up big time by trying to use an Application object for this!<BR><BR>However...<BR><BR>If your code *REALLY* looks like this:<BR><BR>If (Var)=STD Then<BR><BR>then you need to go back and understand how Request.QueryString works and a lot of other things as well. *AT A MINIMUM* you probably need to have<BR><BR>If Request.QueryString("Var") = "STD" Then <BR><BR>But without seeing all your code I can&#039t be sure about the rest.<BR><BR>************<BR><BR>If you care:<BR><BR>Why is <BR><BR>If (Var) = STD Then<BR><BR>*always* true? If you really coded it that way, then both VAR and STD are new and uninitialized variables. So both are considered "empty" values, and two empty values will be equal to each other.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts