Troy Mitchel
Troy Mitchel

Reputation: 1810

Why is my session variable being shared by multiple users in asp.net application

I have a session variable with a datatable assigned to it. For some reason the results from the datatable (display to user in a GridView) are being shared accross multiple users who are logged in. I thought each session was independent? So when one user makes changes then the other users see those results added to their results. Not sure why. I am not using Application variables.

I initialize the Session variable in Global_asax, then populate it on a button command after the user has filled out the required entries.

Imports System.Web.SessionState

Public Class Global_asax
  Inherits System.Web.HttpApplication

  Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
    Session("RDDT") = New DataTable
  End Sub

End Class

Upvotes: 1

Views: 740

Answers (1)

Troy Mitchel
Troy Mitchel

Reputation: 1810

As it stands, I did overlook something. There was a usercontrol that someone else had created that had Public variables. The application was treating them as static. All I did was remove them and changed where in use to Session varibles. The Application works as intended now.

Upvotes: 1

Related Questions