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 8014729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:01:52+00:00 2026-06-04T20:01:52+00:00

I have an asp.net c# web application where a user can log in and

  • 0

I have an asp.net c# web application where a user can log in and see his schedule for the last week, which is stored in a remote database. Logging into the site consists of just an SQL check to see if the username and password matches the uname & pass records in the database. Once logged in, they can manipulate the time entries for the schedule, etc. While debugging, I logged in as two different users. User B had all of user A’s stuff on his form. I wrote the program like I was writing a regular c# app, and didn’t really give any thought to multiple people using the website at the same time. I guess I thought that instance handling would be automatic? I’ve only been working with asp.net for a week or so, and don’t have much support.

My main question is, if I have multiple users on my site at the same time, how do I keep their sessions separate?


update – after adding Session variables

This is my sql statement to get user information. Now, using session variables:

string sqlquery = "SELECT FirstName, LastName, OperatorID FROM operators WHERE EmpID = '" + sql + "'";
        using (MySqlConnection conn = new MySqlConnection(ConfigurationManager.ConnectionStrings["EobrConnectionString"].ConnectionString))
        {
            conn.Open();
            using (MySqlCommand comm = new MySqlCommand(sqlquery, conn))
            {
                using (MySqlDataAdapter adapter = new MySqlDataAdapter(comm))
                {
                    DataTable dt = new DataTable();
                    adapter.Fill(dt);
                    foreach (DataRow dr in dt.Rows)
                    {
                        Session["Fname"] = dr[1].ToString();
                        Session["Lname"] = dr[2].ToString();
                        Session["opID"] = dr[3].ToString();
                     }
                }
            }
        }

In the main menu page I have this:

protected void Page_Load(object sender, EventArgs e)
{
    firstname = Session["Fname"].ToString();
    lastname = Session["Lname"].ToString();
    lblwelcome.Text = "Welcome, " + firstname + " " + lastname + ", make your selection below.";
}

When User A logs in, they see their name “Frank Drebbin”. When User B logs in they see their name, “Jake Gaston”. But now, if I reload the first users page, they see the name as “Jake Gaston”.

  • 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-06-04T20:01:53+00:00Added an answer on June 4, 2026 at 8:01 pm

    You need to use seperate browsers. You’re using sessions to identify users, and sessions are matched to a cookie in your browser From your comments above, here’s what happens

    log in as steve -> session created -> steve stored as username -> cookie returned to browser

    in a new window, log in as frank -> session already exists, rename username to frank.

    in 1st window refresh. -> session username no frank -> return data based on that username.

    New IE windows all share the same context. this means if 1 window gets a cookie, they all do. There are 2 ways around this (actually 3).

    • Use physically different machines
    • Use 2 broswers, eg IE & Firefox
    • In IE press alt to get the menu, then click new session from the file menu. This makes a physically separate window that won’t share cookies (although there’s nothing to indicate this to you)

    Having done the above, try again logging in as Steve & Frank & you should see they don’t interfere with each other.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an 'access denied' problem on an ASP.NET web application, where the user
I have a ASP.NET web application which has more than 100 pages. Each page
I have an ASP.NET web application project which references another project called ModusCore (or
I have a requirement for an ASP.NET web application whereby the same user is
I have an ASP.NET MVC 3 / .NET Web Application, which is heavily data-driven,
I have an ASP .NET web application which uses Forms Authentication. Let's call this
I have an ASP.NET MVC web application. The application can be managed with a
I want to add google earth application to my asp.net web application.User can add
I have a asp.net MVC3 web application in which i search for a certain
I have an ASP.NET web application the entire site is browsed over HTTPS using

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.