locked
question to Session-State Modes - StateServer RRS feed

  • Question

  • User1435223242 posted

    hi, experts,

    just aware of the mode - StateServer

    from doc., https://msdn.microsoft.com/en-us/library/ms178586.aspx

    StateServer mode, which stores session state in a separate process called the ASP.NET state service. This ensures that session state is preserved if the Web application is restarted and also makes session state available to multiple Web servers in a Web farm.

    I have 3 questions,

    1) is the setting applied to both MVC and web form implementation? is State Server Mode working for both web and MVC?

    2) for asp.net, I can have application variable and session variable

    for example,

          System.Web.HttpContext.Current.Session["hello"] = "yes";
                System.Web.HttpContext.Current.Application["helloall"] = "yes yes";

    is State Server Mode working for both web and MVC?

    3) if the web application having login function and some session per login, is State Server Mode working for this scenario ?

    if the user suddenly close the browser, and then relogin, full new set of session variables to be created and saved in State Server.

    or after relogin , previous set of session variables  can be get from State Server?

    thank you very much!

    delaynomore

    Thursday, May 11, 2017 2:17 AM

All replies

  • User475983607 posted

    delaynomore

    1) is the setting applied to both MVC and web form implementation? is State Server Mode working for both web and MVC?

    The setting is application specific and works for both MVC and Web Form applications.

    delaynomore

    2) for asp.net, I can have application variable and session variable

    .

    Session and application are two completely different features in the ASP framework.   Moving to a Session server does not affect Application.

    delaynomore

    3) if the web application having login function and some session per login, is State Server Mode working for this scenario ?

    Generally Session has nothing to do with authentication (login) unless you wrote the application to store user credentials or roles in Session.

    delaynomore

    if the user suddenly close the browser, and then relogin, full new set of session variables to be created and saved in State Server.

    Correct, by default Session cookies are not persisted when the browser is closed.  This is really a configuration feature.  Again, login has nothing to do with Session.  The values stored in Session are explicitly coded.  Review your code for more information.

    delaynomore

    or after relogin , previous set of session variables  can be get from State Server?

    Since Session is stored in a Database you can certainly retrieve any previous state.

    I suggest that you learn ASP Session.  Everything you need is in the link.

    https://msdn.microsoft.com/en-us/library/ms178581.aspx

    I also suggest that you create a simple demo and play with Session state persisted in a DB to get a working idea of how it work.

    Thursday, May 11, 2017 11:07 AM