I'm getting some strange results in an asp.net web application that has
recently gone live.
In the header of almost all the pages, the full name of the currently logged
in user is displayed. On occasion, this changes to the name of some other
user currently on the site.
Needless to say, some find this disconcerting.
The routines that get and display the name are incredibly straight forward
and I am at a loss as to how it could happen at all. The only thing I can
think of is that public functions in modules are in the application scope.
Can someone confirm this? I can't seem to find a definitive answer anywhere.
Here's a quick sketch of how the code is currently working.
There is a file, called "header.asc x" that is included at the top of every
aspx page. In this file on the Page_Load is this code:
oUser = GetUserObject()
If Not (oUser Is Nothing) Then
If IsLen(oUser.Ful lName) Then
lblLogIn.Text = oUser.FullName & logged in"
End If
End If
The function "GetUserObj ect" returns another object, clsUser. It is equally
simple and declared publicly in a module:
Public Function GetUserObject() As clsUser
Dim oUser As New clsUser
Dim oCookie As HttpCookie
Dim lngUserID As Long
oCookie = HttpContext.Cur rent.Request.Co okies("UserID")
If Not oCookie Is Nothing Then
lngUserID = oCookie.Value
If lngUserID > 0 Then
If oUser.LoadObjby UserID(lngUserI D) Then
'Log?
End If
Else
oUser = Nothing
End If
End If
Return oUser
End Function
Any help or feedback would be appreciated.