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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:35:35+00:00 2026-05-25T09:35:35+00:00

I am trying to build an asp.net(c#) page that updates some state texts every

  • 0

I am trying to build an asp.net(c#) page that updates some state texts every second.
Now I have implemented an button that calls another PageMethod which restarts something and takes a little while. The problem is, that when I call the restart PageMethod , the update PageMethod can’t update as long as the restart method is proceeding…

I wrote a little example to show what I mean:

WebMethods in my Page:

    [WebMethod]
    public static string Update()
    {
        //return "a" to see when the Update PageMethod succeeded
        return "a";
    }

    [WebMethod]
    public static string Restart()
    {
        //the restart will take a while
        Thread.Sleep(2000);
        //return "a" to see when the Restart PageMethod succeeded
        return "a";
    }

the html elements to update:

<p id="update" style="float:left;"></p>
<p id="restart" style="float:right;"></p>

the Pagemethod calls:

callUpdate()
            function callUpdate() {
                PageMethods.Update(function (text) {
                    //itself+text from pagemethod
                    $('#update').text($('#update').text() + text);
                });
                setTimeout(callUpdate, 1000);
            }

            callRestart()
            function callRestart() {
                PageMethods.Restart(function (text) {
                    //itself+text from pagemethod
                    $('#restart').text($('#restart').text() + text);
                });

                setTimeout(callRestart, 1000);
            }

Note: The Update is also called every second after it finished, just to see how it works

To clarify: I want the PageMethods to execute independent to that the other PageMethod has finished.

I also flew over some links like:
http://esskar.wordpress.com/2009/06/30/implementing-iasyncresult-aka-namedpipeclientstream-beginconnect/

http://msdn.microsoft.com/en-us/library/aa480516.aspx

But I don’t think this is what I need (?)
And I really don’t know how to call that from Javascript (BeginXXX and Endxxx)

*EDIT: *

Regarding to Massimiliano Peluso, the js code would look like this:

        callUpdate()
        function callUpdate() {
            $.ajax({
                type: "POST",
                url: "ServicePage.aspx/Update",
                data: "{}",
                contentType:
                "application/json; charset=utf-8",
                dataType: "json",
                success: function (msg) {
                    $('#update').text($('#update').text() + msg.d);
                }
            });
            setTimeout(callUpdate, 1000);
        }

        callRestart()
        function callRestart() {
            $.ajax({
                type: "POST",
                url: "ServicePage.aspx/Restart",
                data: "{}",
                contentType:
                "application/json; charset=utf-8",
                dataType: "json",
                success: function (msg) {
                    $('#restart').text($('#restart').text() + msg.d);
                }
            });
            setTimeout(callRestart, 1000);
        }

Note: when I run the Page with the new js, there is exactly the same problem as before: The Update method can do nothing until the Restart method is finished.

  • 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-25T09:35:35+00:00Added an answer on May 25, 2026 at 9:35 am

    It’s because an Request only Proceeds when no other Request is processing.
    Thats because two Processes can’t acess to the same SessionState (Sessionstate is not Threadsafe).

    So to achieve that Requests are processed at the same time, you have to set EnableSessionState in the @Page directive to either 'ReadOnly' or 'false'

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

Sidebar

Related Questions

I'm trying to build an ASP.NET page that adds a work item in TFS.
I'm trying to build a search page in ASP.NET that allows me to search
Question I'm trying to build a quick and easy ASP.NET page that redirects a
I'm trying to build an asp.net page using c# that will query a column
I'm trying to build an ASP.NET page that can crawl web pages and display
I am trying to build an iPhone web application using ASP.NET. The page is
I am trying to build an ASP.NET 3.5 website that allows users to log
I'm trying to make a very simple asp.net page that binds a GridView using
I am trying to build an uploader with ASP.NET MVC, but I'm having a
I'm trying to build a generic grid view in an ASP.NET MVC application. Let

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.