Results 1 to 5 of 5

Thread: Session Variable Clarification

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140

    Session Variable Clarification

    Okay... I have a question...

    There is an ASP that lets you modify an employees contact info. You select the employee (say Joe) from a drop down box and click on a link and boom, you are in a form to update some stuff.

    If you say "File -> New -> Window" in IE (and I'm sure the same in Netscape) then you now have two browsers open to the same modify employee page. Lets call these browser instance A and B.

    Okay, go back in B. Select a different employee (say Bob). Change the information in A and submit. A will go back to the start page by default. If you look in the list of employee, there are now two Joes. The original one, and the one that just overwrote Bob.

    The problem is, Session Variables. How can I set these up to limit themselves to just one instance of a browser and avoid this problem?

    My immediate solution is to use hidden inputs instead of session variables.
    Travis, Kung Foo Journeyman
    As always, RTFM.

    WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
    Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    YBMS, but Mozilla doesn't.

  2. #2
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    Sessions are based on Cookies, and as far as I know, web browsers will return the Cookie across different browser windows. It would have to be a client-config option...
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    Which means that I'll have to use the hidden inputs.
    Travis, Kung Foo Journeyman
    As always, RTFM.

    WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
    Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    YBMS, but Mozilla doesn't.

  4. #4
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    Just another reason to not use Session variables...

    Keep your page stateless...
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

  5. #5
    idover
    Guest
    well... here's a solution... as long as the user doesn't press F5 or Refresh as if that'll ever happen... but, after a few times, s/he will learn not to... lol...

    Code:
    ' check for multiple clients with same session id
    Session("clientCount") = Session("clientCount") + 1
    
    If Session("clientCount") > 1 Then ' this window doesn't belong
    	Response.Redirect "http://www.vbworld.com"
    End If
    i put it at the very top of the page... and it works fine for my scenario, except for when one refreshes the original window... maybe a hidden or querystring variable could be used to designate which window is the original window?... i'm going home... so good luck...

Posting Permissions

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



Click Here to Expand Forum to Full Width