No, it will not.
In fact, I would make all the methods in EmployeeSession Shared. So you
don't need to bother instantiating it every time. Then something like this:
Public Shared Property EmployeeID() As Integer
Get
CInt(GetItem("EmployeeID"))
End Get
Set(Value As Integer)
SetItem("EmployeeID",Value)
End Set
End Property
Private Shared Function GetItem(itemName As String) As Object
Return HttpContext.Current.Session(itemName)
End Function
Private Shared Sub SetItem(itemName As String, itemValue As String)
HttpContext.Current.Session(itemName) = itemValue
End Sub
That way you can say EmployeeSession.EmployeeID, without instantiating
anything. Also, all the functionality of how everything is stored, is
actually in GetItem and SetItem, properties call out to that.
And lastly, please turn Option Strict On in your project, and make this the
default. This will save you many hours by catching errors at run time.
"MS ASP.NET" <sb*****@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
I'm using sql server session state and wrote a class to wrap current
session. I need to know if what I am doing will result in users
sharing session data.
'----------------------------------
'------- Session Wrapper --------
'-----------------------------------
Imports System.Web.SessionState
Public Class EmployeeSession
Private _session As HttpSessionState
Sub New()
_session = HttpContext.Current.Session
End Sub
Property EmployeeID() As Integer
Get
Return _session("EmployeeID")
End Get
Set(ByVal Value As Integer)
_session("EmployeeID") = Value
End Set
End Property
End Class
'-----------------------------------
'-----------------------------------
'-------- Sub on a web form -------
'-----------------------------------
Private Sub DoSomething
Dim empSession as new EmployeeSession
empSession.EmployeeID=someValue
End Sub
'----------------------------------
Any ideas or help appreciated
Steve