Page view counter

session

Last post 12-03-2008 3:47 AM by darkcat02. 6 replies.

Sort Posts:

  • session

    07-03-2008, 1:05 AM
    • Loading...
    • foekall
    • Joined on 07-03-2008, 3:49 AM
    • Posts 3
    • Points 1

    Dear all

    I would like to ask about session in asp.net(C#). In my new project I am using many sub domain by category. I want to control session state between each domains. Can I? plz help me?

     thz all
     

  • Re: session

    07-03-2008, 1:46 AM
    • Loading...
    • niharnayak2003
    • Joined on 11-22-2007, 4:59 AM
    • Chennai
    • Posts 192
    • Points 1,030

    Use Out Process and save your session in Sql server it will easy to manage 

    Using eighter SQL Server Session State or State Servers instead of the default InProc mode has the benefit of making your site more scalable and reliable by storing session information on a SQL Server database or on another machine on the web farm. So in both scenarios the web server will be less busy handling session information and will have more time to service requests. On the other hand, the InProc mode is the fastest mode because it keeps all the information on the web server's memory. You can also take a look at the following greate links for more information on choosing the right mode and configuring OutProc session state management:


    For SQl Server 

    For State Server

    <sessionState mode="StateServer" stateConnectionString="tcpip=127.0.0.1:55455" sqlConnectionString="data source=127.0.0.1;user id=sa;password='' cookieless="false" timeout="20"/>

    The attributes are self explanatory but I will go over them.

    mode: This can be StateServer or SqlServer. Since we are using StateServer we set the mode to StateServer.

    stateConnectionString: connectionString that is used to locate the State Service. 

    sqlConnectionString: The connection String of the sql server database.

    cookieless: Cookieless equal to false means that we will be using cookies to store the session on the client side.

    For SQL Server

    <sessionState mode = "SqlServer" stateConnectionString="tcpip=127.0.0.1:45565"

    sqlConnectionString="data source="SERVERNAME;user id=sa;password='' cookiesless="false" timeout="20"/>

    Nihar ranjan Nayak
    Microsoft certified Professional
    niharnmayak2003@yahoo.co.uk
    www.webnihar.com
  • Re: session

    07-03-2008, 7:24 AM
    • Loading...
    • ASHISH1985S
    • Joined on 06-26-2008, 6:30 AM
    • Posts 23
    • Points 140

     Hello,

    Session in ASP.net can be stored in 3 ways.
    1. Inproc
    2. State Server
    3. SqlServer


    The InProc mode of Session State management is the fastest among all of the storage modes available and stores the Session data in the ASP.NET worker process.
    Performance will be effected if the amount of data stored in the session is large. Basically the session is stored in the memory space of an application
    domain and is volatile.So if asp.net worker process i.e. aspnet_wp.exe restarts then the session state will be lost.
    The Session State here entirely depends on the lifetime of the application domain that it runs on. Note that the Session_End event which is fired internally by the web server is supported only in InProc mode. Note that even if the Session State is set to read only using the EnableSessionState attribute, in the InProc mode one can still modify the session. The Session_OnEnd event is invoked by the runtime environment when we make a call to the Session.Abandon() method or when the user's session times out. Further, any change made in the settings in the web.config file unloads the application domain and the Session State too.


    The StateServer mode uses a stand-alone Microsoft Windows service that is independent of IIS and can run on a separate server.
    In this case the session state is serialized and stored in memory in a separate process that is managed by the aspnet_state.exe file.
    This has got some performance drawbacks due to the overhead involved in serialization and de-serialization of objects.
    The main primary advantage of storing the Session State in a State Server is that it is not in the same process as the ASP.NET and a crash of ASP.NET
    would in no way destroy the session data. Secondly, this mode of Session State storage enables to share the information across a web garden or a web farm.

    Rememeber that this mode is slow compared to the InProc mode as it is stored in an external process.

    The SQLServer mode of Session State management is a reliable, secure and centralized storage of a session state
    In this the Session data is serialized and stored in a database table in the SQL Server database.
    It can typically be used in the web farms.

    It has performance bottlenecks as in the State Server mode of Session State management due to the overhead involved in serialization and de-serialization
    of the objects that are stored and retrieved to and from the Session.
    SQL Server is more secure than the InProc or the State server modes of Session State storages as the data can be secured easily by
    configuring the SQL Server security. 

     

    I hope this will helps you out..

     

    With Regards..

     

    Ashish Shah

    India

     

    NOTE:: PLease mark this post as answered if you like / post is useful to you... 

  • Re: session

    07-04-2008, 1:24 AM
    • Loading...
    • foekall
    • Joined on 07-03-2008, 3:49 AM
    • Posts 3
    • Points 1

    niharnayak2003:

    For SQl Server 

    For State Server

    <sessionState mode="StateServer" stateConnectionString="tcpip=127.0.0.1:55455" sqlConnectionString="data source=127.0.0.1;user id=sa;password='' cookieless="false" timeout="20"/>

    For SQL Server

    <sessionState mode = "SqlServer" stateConnectionString="tcpip=127.0.0.1:45565"

    sqlConnectionString="data source="SERVERNAME;user id=sa;password='' cookiesless="false" timeout="20"/>

     

     


    Dear bro...

    Plz let me know. My project have using many web application. So, do I need to write this SessionState any web.config file from every application and were can I write this in web.config. Smile

  • Re: session

    07-04-2008, 1:51 AM
    • Loading...
    • tasnim5
    • Joined on 06-08-2006, 4:24 AM
    • Mumbai, India
    • Posts 272
    • Points 1,654
    Regards,
    Ahmed

    ***************************************************
    Please don't forget to mark the post as Answer, which helps you.

    Thank you.
    www.ahmadtasnim.com
  • Re: session

    07-04-2008, 2:06 AM
    Answer
    • Loading...
    • santa_1975
    • Joined on 06-30-2008, 6:20 AM
    • Posts 428
    • Points 2,624

    If I'm not wrong, you're trying to share the session across multiple ASP.NET applications.

    Here's how you do it...

    1) Use SQL Server for storing session state.

    2) Tweak "TempGetAppID" in the session database so that it returns session values for multiple applications  - refer to the below link to achieve this.

    http://blogs.msdn.com/toddca/archive/2007/01/25/sharing-asp-net-session-state-across-applications.aspx

    Hope this helps.

     

  • Re: session

    12-03-2008, 3:47 AM
    • Loading...
    • darkcat02
    • Joined on 05-06-2008, 2:27 AM
    • Manila, Philippines
    • Posts 149
    • Points 178

     hi,

    how did you manage the serialization using vb? im not using class but function... any ideas? thanks a lot... 

    im not using c#.... 

    Regards,
    Mhaey

    Please remember to click “Mark as Answer” on the post that helps you.. =)
Page 1 of 1 (7 items)