Different types of mode in session?


You can store session's data in 3 different ways.

     1)Inproc (In-Process Mode):
         This Method is most common and default method to store session specific information.This mode is best fit for small applications which can be host on a single server.
         Session information/data stored in memory of local web server(aspnet_wp.exe).
         Syntax:
                 <sessionState mode = "inproc"
          cookieless = "true|false"
                    timeout = "20" />
        This mode will be faster than the other 2 modes (StateServer and SqlServer) But Session data will be lost if the worker process or application domain recycles.

    2)State Server Mode:
        This mode is suitable for scalable and highly available applications.
        In this mode , sessions are serialized and stored in memory in a separate process aspnet_state.exe.  State Server can run on another machine.

        Syntax:
                         <sessionState mode="StateServer"
                            StateConnectionString="tcpip=127.0.0.1:42424"
                            cookieless="false" timeout="20"/>
    3)SQLServer Mode:
        In this Mode, sessions are serialized and stored in SQL server.
       
        Syntax:
<sessionState mode="SQLServer"
                    sqlConnectionString="data source=server;user id=userid;password=pwd"
                    cookieless="false" timeout="20" />

No comments:

Post a Comment