locked
session RRS feed

  • Question

  • User-169979396 posted

    hello,

    when i create Session

    like this: Session["Login"] = txtEmail.text;

    when the user create the session  i want know where the session created ,

    at the server or at the client machine?

    if it created at the server is that meaning if i have 2 users in my website and the first user create the session, the second user will use the same session that crated by the first user or a new session will created?

    Tuesday, August 30, 2016 10:11 AM

Answers

  • User-1377768212 posted

    Hi,

         The session state is used to maintain the session of each user throughout the application. Session allows information to be stored in one page and access in another page and support any type of object. In many websites we will see the functionality like once if we login into website they will show username in all the pages for that they will store username in session and they will access that session username in all the pages.

    Please check the following articles :

    http://www.c-sharpcorner.com/article/Asp-Net-session-state/

    http://www.aspdotnet-suresh.com/2012/11/aspnet-session-state-example-in-c-vbnet.html

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, August 30, 2016 11:23 AM
  • User465171450 posted

    A cookie is set on the client's machine with an ID. The server stores the session data in it's memory and looks it up by ID. Sessions are created per-user, and created when the user first requests a resource from the server. Once they haven't made a request in X minutes (normally 20 but you can alter that) the session is destroyed so the memory can be collected by the application pool.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, August 30, 2016 11:27 AM
  • User-471420332 posted

    Hi msomar,

               Commonly Session will used for login page, from login page If username and password correct then you can pass session values to every page. Like below

    In Login Page If username and password is correct then, pass username like below from login page to all pages.

               If(Status=="Success")

              {

                  Session["username"]=txtusername.txt;

               }

            For getting session value into label in a particular page you have to get like that session values.

             lbl_username.Text= Session["username"];

    Dont be confuse session will be stored on browser cookies and if you logout then will expired.

    Thanks

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, August 30, 2016 12:21 PM

All replies

  • User-1377768212 posted

    Hi,

         The session state is used to maintain the session of each user throughout the application. Session allows information to be stored in one page and access in another page and support any type of object. In many websites we will see the functionality like once if we login into website they will show username in all the pages for that they will store username in session and they will access that session username in all the pages.

    Please check the following articles :

    http://www.c-sharpcorner.com/article/Asp-Net-session-state/

    http://www.aspdotnet-suresh.com/2012/11/aspnet-session-state-example-in-c-vbnet.html

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, August 30, 2016 11:23 AM
  • User465171450 posted

    A cookie is set on the client's machine with an ID. The server stores the session data in it's memory and looks it up by ID. Sessions are created per-user, and created when the user first requests a resource from the server. Once they haven't made a request in X minutes (normally 20 but you can alter that) the session is destroyed so the memory can be collected by the application pool.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, August 30, 2016 11:27 AM
  • User-471420332 posted

    Hi msomar,

               Commonly Session will used for login page, from login page If username and password correct then you can pass session values to every page. Like below

    In Login Page If username and password is correct then, pass username like below from login page to all pages.

               If(Status=="Success")

              {

                  Session["username"]=txtusername.txt;

               }

            For getting session value into label in a particular page you have to get like that session values.

             lbl_username.Text= Session["username"];

    Dont be confuse session will be stored on browser cookies and if you logout then will expired.

    Thanks

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, August 30, 2016 12:21 PM
  • User-1404113929 posted

    hi,

    session is not related to login,

    each new request, session will created.

    and session is user spesific.

    Thursday, September 1, 2016 11:05 AM