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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:39:49+00:00 2026-05-30T14:39:49+00:00

I have an asp.net website to manage projects. I realized that when I click

  • 0

I have an asp.net website to manage projects. I realized that when I click for the next project really fast and often it overrides all the next projects with the data of the first one. I call a method to save before to go for the next project. I use also a session variable for the id of the project.

EDIT:

It looks like the sever stacks the save method and the ids but keeps the values of the first project in the controls

Am I right?

this is the ajax that calls a server method to get the id and set it in an hidden field:

function NextClick() {
            var tabvalue = $("#<%=TabsToFocus.ClientId%>").val();
            $.ajax(
                {
                    type: "POST",
                    url: "Projet.aspx/NextProj",
                    data: "{tab:'" + tabvalue + "'}",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function(d) {
                        if (d.d != "False") {
                            $("#<%=hid_selProjetID.ClientID%>").val(d.d);
                            var btn = $("#<%=btnClickLstProjet.ClientID%>");
                            fillHidden();
                             btn.click();
                        }
                    }
                });
            }

And btn.click() calls this method on the server side to save

Private Sub Button1_ServerClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnClickLstProjet.ServerClick

    If HttpContext.Current.Session.Item("isUser") IsNot Nothing AndAlso HttpContext.Current.Session.Item("isUser") = True Then
        If HttpContext.Current.Session.Item("curProjetID") IsNot Nothing Then

            btnSaveIndicateurs_Click()
            btnSaveEnTete_Click()
            btnSaveGen_Click()
            btnSavePlanif_Click()
        End If
    End If

    HttpContext.Current.Session.Item("curProjetID") = hid_selProjetID.Value
    Response.Redirect("Projet.aspx")

End Sub

Thank you

  • 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-30T14:39:50+00:00Added an answer on May 30, 2026 at 2:39 pm

    The very first thing you should do is STOP using session.

    Seriously, back away from the session object.

    A proper use of session is long term, fairly unchanging data. Data that has to change on literally every post back etc belongs in the page itself.


    Here is what’s happening.

    1. You click on a link to load up the project. The Session variable is being set with the current project id.

    2. You then click on a link to get the next project,

    3. Then quickly click on the link to get the one after that.

    The server, meanwhile, is multithreaded. #3 basically interupted #2’s execution.. and ran before #2. This means your session variable is jacked up.

    Why would the 3rd request run before the 2nd? Well, you are executing a number of queries. It’s likely that the queries for request 2 are taking slightly longer to exec than the ones for request 3.

    Solution: Stop using Session.

    Why: You cannot predict the order in which IIS is going to respond to requests. IIS is a parallel (not serial) engine and requests might very well happen out of the sequence you think they should.

    Finally, the guy who said that session is locked by the first requestor wasn’t entirely accurate. It is WRITE locked.. but that only occurs when the page starts writing to session. Reads are not locked.

    So, when request 3 executes it is using the ID of request 1, or 2. Depending on which one is still active by the time it hits the write code.

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

Sidebar

Related Questions

I have an asp.net-mvc website and people manage a list of projects. Based on
I have a ASP.Net website that is failing on AJAX postbacks (both with ASP.Net
I have an asp.net website that allows the user to download largish files -
I have an asp.net website that has been running well in IIS 6.0. I
I have a reasonably large project at work that I've inherited. It's an ASP.NET
I'm currently using Subversion to manage my ASP.NET website. I'm finding that whenever I
I have an application to be written in ASP.Net 3.5 that needs to manage
I have asp.net mvc website and in some pages i need a paging feature,
I have a asp.net website hosted in IIS 5 and i don't have access
I have an ASP.NET website and when I press F5 it automatically attaches to

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.