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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:45:36+00:00 2026-05-26T00:45:36+00:00

I have 2 MVC apps that need to connect to a 3rd application. The

  • 0

I have 2 MVC apps that need to connect to a 3rd application. The code that is causing problems is identical in both MVC apps.

    public bool UpdateServerData()
    {
            //string BASE_URL = "http://";
            string BASE_URL = "http://localhost:55094";
            string url = BASE_URL + "/Home/PullLiveData";
            WebRequest wr = WebRequest.Create(url);
            wr.Credentials = CredentialCache.DefaultNetworkCredentials; // uses current windows user
            var response = (HttpWebResponse)wr.GetResponse();
            return true;
    }

    public ActionResult GetServerUpdateProgress()
    {
            //string BASE_URL = "http://";
            string BASE_URL = "http://localhost:55094";
            string url = BASE_URL + "/Home/UpdateProgress";
            WebRequest wr = WebRequest.Create(url);
            wr.Credentials = CredentialCache.DefaultNetworkCredentials; // uses current windows user

            var myobj = new UpdateAJAXProgress();
            var response = (HttpWebResponse)wr.GetResponse();
            var reader = new StreamReader(response.GetResponseStream());
            JavaScriptSerializer js = new JavaScriptSerializer();
            var objText = reader.ReadToEnd();
            myobj = (UpdateAJAXProgress)js.Deserialize(objText, typeof(UpdateAJAXProgress));
            return Json(myobj);
        }

UpdateServerData tells localhost:55094 to refresh the data in the db.
GetServerUpdateProgress returns a progress count / total so that I can display a progress bar for the db refresh.

The $.ajax that runs UpdateServerData is set to work async: true

Then using setTimeouts, I run GetServerUpdateProgress every few seconds which returns how far along UpdateServerData is from completing.

Working App Functionality:
enter image description here

Not Working:

enter image description here

So what appears to be happening in the non-working version is that it is not running GetServerUpdateProgress even though ajax is calling up the function, it doesn’t actually begin to process anything inside it until UpdateServerData is complete. You can see the ajax is sync is set correctly because the loading animation is displayed for both in the non working screen shot. I put a breakpoint at the start of GetServerUpdateProgress and it doesn’t even trigger until after UpdateServerData is finished processing.

My main concern is that some setting, perhaps in the webconfig or global.asax, is different and that is what is causing both these apps to run a little differently. Any ideas?

Here’s some of the associated javascript:

function UpdateData()
{
        $("#ChartUpdateProgressWhole").show();

    $.ajax({
        type: "POST",
        async: true,
        url: '@(Url.Action("UpdateServerData", "Charts"))',
        contentType: "application/json; charset=utf-8",
        success: function (data) {
            Alert2({
                iconfilename: "tick.png",
                text: "Database Updated!",
                autohide: true,
            });
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {

        },
        complete:function (jqXHR, textStatus) {
            $("#ChartUpdateProgressWhole").hide();
            timerStop = true;
            LoadChart();
        },
    });

    if (!timerStop) {
        CheckProgress();
        }
}
function CheckProgress()
{
    if(timerStop) {
        CheckProgressAjax();
        return;
    }
    window.setTimeout(CheckProgress, 2000);
    CheckProgressAjax();
}

function CheckProgressAjax()
{
    $.ajax({
        type: "POST",
        async: false,
        url: '@(Url.Action("GetServerUpdateProgress", "Charts"))',
        contentType: "application/json; charset=utf-8",
        success: function (data) {
            var width = (data.Completed * 100)/data.Total;
            $("#ChartUpdateProgressPercent").css("width", width);
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            alert(XMLHttpRequest.status);
            alert(XMLHttpRequest.responseText);
        }
    });
}
  • 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-26T00:45:36+00:00Added an answer on May 26, 2026 at 12:45 am

    Taking a bit of a stab in the dark here, but ASP.NET will actually queue async requests and process them in order if session state is enabled (to avoid having to deal with synchronisation issues no doubt).

    My suggestion would be to disable session state all together if feasible, if this is not possible you can disable it per controller using the following attribute:

    [SessionState(SessionStateBehavior.Disabled)]
    public class SomeController
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an MVC application that among other things contains a small Silverlight menu
I have an MVC application view that is generating quite a large HTML table
I have a solution file with two applications loaded. Both are MVC enabled apps,
We have an ADFS 2.0 installation that's working well for our MVC apps in
In a typical MVC application we have validation that occurs in many different places.
I have a copule of MVC apps. I'd like to be able to redirect
I have a MVC app and using JQuery. I have anchor that I setup
I have an MVC application which is my marketing website, and two other regular
I have an MVC application which has a set of fields for contact details
I have an MVC application. Say for example if we have a dropdown Cars

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.