Problem with unique session variables

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Problem with unique session variables

    Hi,

    I got here the following problem. I am programming
    web application for examing students.
    After student will log on I need to keep his ID,
    Privileges, Login, Password for manipulating with other
    functions. All these information I will keep by

    Session["ID"] = "2"
    Session["Privileges"] = "Student"

    and so on...
    But my problem is, when later will log on teacher in
    Session["Privileges"] will be "Teacher". It will be
    replaced, so student will receive privileges of teacher.
    And that is my problem. I heard that it is neccessary to
    create unique ID for session.
    I am working in ASP.NET with C# and there is
    possibility to create this ID with method
    Session.SessionID() but I dont know how to use it, how
    those session variables can be different...

    Is anybody here, who can show me some easy example how
    to solve my problem?
    Please. Thank you very much...

    Newton

    Newton Guest

  2. Similar Questions and Discussions

    1. Problem with Session Variables
      This is probably going to be very simple, but I?m stumped (Infrequent CF User). I?m trying to create a login/welcome page for my application, but...
    2. Problem with SESSION variables...
      Hi. Im very new to php, and I have a problem here that I cant find the solution for. I have problems with session variables, I want some variables...
    3. Session variables problem...
      i have a project which is include ASP, VB, VB COM, MTS, IIS. when the user enter the site the user is asked to login using UserID and Password...
    4. Session problem when setting session variables in files that are in different directories
      I am running PHP 4.3.0 on a WinXPpro machine and I recently got problem with sessions. What I am building is a loginsystem and I need to save...
    5. Problem with unique session variables...
      This is a classic asp newsgroup. While you may be lucky enough to find a dotnet-savvy person here who can answer your question, you can eliminate...
  3. #2

    Default Re: Problem with unique session variables

    Newton,

    Session variables are unique by nature.

    Unless the teacher and the student log on to the exact same machine (and for
    that matter without closing the browser windows) the Session["Privileges"]
    variables will be tracked seperately for each user.

    You shouldn't have a problem using the Session variable as is.

    I hope this is good news! :)

    --
    S. Justin Gengo, MCP
    Web Developer

    Free code library at:
    [url]www.aboutfortunate.com[/url]

    "Out of chaos comes order."
    Nietzche
    "Newton" <newton.finsko@pobox.sk> wrote in message
    news:03c701c3508c$53f56320$a301280a@phx.gbl...
    > Hi,
    >
    > I got here the following problem. I am programming
    > web application for examing students.
    > After student will log on I need to keep his ID,
    > Privileges, Login, Password for manipulating with other
    > functions. All these information I will keep by
    >
    > Session["ID"] = "2"
    > Session["Privileges"] = "Student"
    >
    > and so on...
    > But my problem is, when later will log on teacher in
    > Session["Privileges"] will be "Teacher". It will be
    > replaced, so student will receive privileges of teacher.
    > And that is my problem. I heard that it is neccessary to
    > create unique ID for session.
    > I am working in ASP.NET with C# and there is
    > possibility to create this ID with method
    > Session.SessionID() but I dont know how to use it, how
    > those session variables can be different...
    >
    > Is anybody here, who can show me some easy example how
    > to solve my problem?
    > Please. Thank you very much...
    >
    > Newton
    >

    S. Justin Gengo Guest

  4. #3

    Default Problem with unique session variables

    >-----Original Message-----
    >Hi,
    >
    > I got here the following problem. I am programming
    >web application for examing students.
    > After student will log on I need to keep his ID,
    >Privileges, Login, Password for manipulating with other
    >functions. All these information I will keep by
    >
    > Session["ID"] = "2"
    > Session["Privileges"] = "Student"
    >
    >and so on...
    > But my problem is, when later will log on teacher in
    >Session["Privileges"] will be "Teacher". It will be
    >replaced, so student will receive privileges of teacher.
    >And that is my problem. I heard that it is neccessary to
    >create unique ID for session.
    > I am working in ASP.NET with C# and there is
    >possibility to create this ID with method
    >Session.SessionID() but I dont know how to use it, how
    >those session variables can be different...
    >
    > Is anybody here, who can show me some easy example how
    >to solve my problem?
    >Please. Thank you very much...
    >
    > Newton
    >
    >.
    >
    ..Net will create the unique ID automatically.

    In machine.config, set the

    <sessionState mode=

    setting to "InProc" (unless you have a web farm, then
    you'll need to use a StateServer or SQLServer to maintain
    session state). Also set the appropriate session timeout
    (in minutes) in the same line. This will timeout the
    session within the set number of minutes of INACTIVITY.

    Then provide the user with a way to logout, which should
    call Session.Abandon to log out of the current session.

    Finally, at the top of each page, check Session
    ["Privileges"], and if not set, redirect to the login page.

    That should allow you timeout users, and allow them to log
    themselves out.

    Bill Richardson
    Proflowers.com
    Bill Richardson Guest

  5. #4

    Default Re: Problem with unique session variables

    Hi,
    believe me... they are not unique by nature... I started
    internet explorer with my application and logged on as a
    student, clicked the button and this application shown me
    that student has logged on. Then i opened another
    explorer and logged on as a teacher, clicked the button
    and application shown me that teacher has logged on. Then
    I returned to that explorer where student has logged on,
    clicked the button and it shown me, that teacher has
    logged on, so the session variable was overwritten.

    Believe me... theyu are not unique by nature...
    >-----Original Message-----
    >Newton,
    >
    >Session variables are unique by nature.
    >
    >Unless the teacher and the student log on to the exact
    same machine (and for
    >that matter without closing the browser windows) the
    Session["Privileges"]
    >variables will be tracked seperately for each user.
    >
    >You shouldn't have a problem using the Session variable
    as is.
    >
    >I hope this is good news! :)
    >
    >--
    >S. Justin Gengo, MCP
    >Web Developer
    >
    >Free code library at:
    >[url]www.aboutfortunate.com[/url]
    >
    >"Out of chaos comes order."
    > Nietzche
    Newton Guest

  6. #5

    Default Re: Problem with unique session variables

    Newton,

    Was this on the same machine? Sessions are unique to the machine not to each
    browser window...

    If this was on the same machine then you are getting the behaviour this was
    designed to produce.

    --
    S. Justin Gengo, MCP
    Web Developer

    Free code library at:
    [url]www.aboutfortunate.com[/url]

    "Out of chaos comes order."
    Nietzche
    "Newton" <newton.finsko@pobox.sk> wrote in message
    news:082401c350ef$17ff29b0$a601280a@phx.gbl...
    > Hi,
    > believe me... they are not unique by nature... I started
    > internet explorer with my application and logged on as a
    > student, clicked the button and this application shown me
    > that student has logged on. Then i opened another
    > explorer and logged on as a teacher, clicked the button
    > and application shown me that teacher has logged on. Then
    > I returned to that explorer where student has logged on,
    > clicked the button and it shown me, that teacher has
    > logged on, so the session variable was overwritten.
    >
    > Believe me... theyu are not unique by nature...
    >
    > >-----Original Message-----
    > >Newton,
    > >
    > >Session variables are unique by nature.
    > >
    > >Unless the teacher and the student log on to the exact
    > same machine (and for
    > >that matter without closing the browser windows) the
    > Session["Privileges"]
    > >variables will be tracked seperately for each user.
    > >
    > >You shouldn't have a problem using the Session variable
    > as is.
    > >
    > >I hope this is good news! :)
    > >
    > >--
    > >S. Justin Gengo, MCP
    > >Web Developer
    > >
    > >Free code library at:
    > >[url]www.aboutfortunate.com[/url]
    > >
    > >"Out of chaos comes order."
    > > Nietzche
    >

    S. Justin Gengo Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139