When is it appropriate to use ASP.NET Session Vari

Results 1 to 2 of 2

Thread: When is it appropriate to use ASP.NET Session Vari

  1. #1
    Join Date
    Dec 1969

    Default When is it appropriate to use ASP.NET Session Vari

    Hi.<BR><BR>I&#039;m working on a web app that reads some data from an Excel file via OleDb. Once it has the data, it attempt to insert it into a database. If any of the insertions violate a constraint, I display an Errors Table (using a DataGrid) that give the users the ability to make changes to the bad data. Once the data has been corrected, I then try to re-insert the data into the database.<BR><BR>I found that the easiest way to do this is by actually storing the Errors Table (which is a DataTable) in a session variable. I actually seems to be much faster than re-generating the errors table with each post back.<BR><BR>I normally avoid session variables like the plague, but could this be a case where it might make sense? This is not a application that will have 100s (or even dozens) or users accessing it at the same time. And once the data is in the database, I can set the session variables to null.<BR><BR>Any ideas / suggestions on this?<BR>-Steve

  2. #2
    Join Date
    Dec 1969

    Default RE: When is it appropriate to use ASP.NET Session

    I would say that this is ok, as long as you&#039;re not seeing memory pressure on the server. If you *are* seeing memory pressure, and particularly if it&#039;s an intrAnet app, you might want to consider persisting the table through viewstate instead...But unless it&#039;s causing issues, I don&#039;t think that keeping it in session is a bad idea at all.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts