Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Alternatives to using session variables in ASP.net & C#

  • 28-09-2012 07:47PM
    #1
    Registered Users, Registered Users 2 Posts: 9,585 ✭✭✭


    I've noticed that session variables can be shared between browser sessions on a client if the same browser is used to open up multiple instances of the same website developed in ASP.net.

    This could be very problematic. What's the current thinking regarding session variables and IIS? Everyone seems to be saying to go stateless to facilitate server farms and the like, but in large enterprise systems it's sometimes handy to store SQL Server/Oracle transaction items in session variables so you can roll-back if the user doesn't want to commit on a multi-table insert/update.

    Thanks!


Comments

  • Registered Users, Registered Users 2 Posts: 2,781 ✭✭✭amen


    SQL Server/Oracle transaction items in session variables so you can roll-back if the user doesn't want to commit on a multi-table insert/update

    How long are you keeping these transactions in call for ?

    You do realise that doing this could negatively affect the DB performance and cause deadlocks.


  • Registered Users, Registered Users 2 Posts: 9,585 ✭✭✭DublinWriter


    amen wrote: »
    How long are you keeping these transactions in call for ?

    You do realise that doing this could negatively affect the DB performance and cause deadlocks.
    Minutes and yes.


  • Registered Users, Registered Users 2 Posts: 12,025 ✭✭✭✭Giblet


    You should probably be looking at Transaction Per Request, or even using an ActionFilter to handle it (MVC). Why are you persisting a transaction over multiple requests? If you are creating an inconsistent state in the Database for a long duration, you may need to think about exactly why you are doing that. Surely you would have problems with transaction scopes?


  • Moderators, Society & Culture Moderators Posts: 9,688 Mod ✭✭✭✭stevenmu


    Are you actually holding a DB transaction open across requests/page loads, or just building up the values for the transaction in your session variables?


Advertisement