Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6064719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:18:40+00:00 2026-05-23T09:18:40+00:00

I am tracking down a bug in some old aspx code. The problem is

  • 0

I am tracking down a bug in some old aspx code. The problem is that one some very rare occations (1/10.000 pageviews or so) two users are mixed up, ie. user A sees user B data.

Here is how the code is structured: We have a user class which is defined in a module like this:

Public Module MyGlobals
    Public myUser As CMyUser
End Module

On the loginpage, we validate the username/password and if valid then the coorosponding userid is loaded from db, and we do:

FormsAuthentication.SetAuthCookie(userid, False)

Then we redirect to the secure area. In the secure areas MasterPage, on event Page_Init, we then have:

If Context.User.Identity.IsAuthenticated then
    ' Initialize the user class (user data is loaded)
    MyGlobals.myUser = New CMyUser(Context.User.Identity.Name)
Else
    ' Redirect to loginpage
End If

Hereafter, is it safe to access the

MyGlobals.myUser

instance from every page which has the secure masterpage as masterpage, or could there be issues with this structure?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T09:18:40+00:00Added an answer on May 23, 2026 at 9:18 am

    A VB.Net Module is like a static class with a private constructor and only static fields in C#.

    That means, all variables declared in a module are shared across all threads. Hence every request(User) that’s using this module will overwrite the old value.

    I would strongly recommend to use Session to store user-sensitive data.
    But i’m not sure why you want to store the Username because it’s already stored when using FormsAuthentication(as you’ve shown yourself above).

    If you really need this wrapper, you could easily achieve it even in a static context via HttpContext.Current.Session:

    Module MyGlobals
        Public Property myUser As CMyUser
            Get
                If HttpContext.Current.Session("CurrentUser") Is Nothing Then
                    Return Nothing
                Else
                    Return DirectCast(HttpContext.Current.Session("CurrentUser"), CMyUser)
                End If
            End Get
            Set(ByVal value As CMyUser)
                HttpContext.Current.Session("CurrentUser") = value
            End Set
        End Property
    End Module
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Today I was tracking down a floating point exception in some code I had
I spent part of yesterday and today tracking down a bug in some Matlab
I was writing a script that kept giving me errors. After tracking it down
I'm working at a development shop that is using outdated bug tracking software. They're
I need some help tracking down a bit of nitty gritty information on the
So I'm pulling my hair out over this one. I've been tracking down a
I was tracking down a bug in a small .NET app written here at
We are tracking down some memory issues in our application and we have visibility
I'm working on tracking down some difficult to find memory leaks in my iPhone
I spent about 2 hours tracking down a bug today and I would've found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.