1

I would like to solve a specific question I got, so this question is more likelly a discussion.

Basiclly, there is an asp.net project with a WebForm1.aspx, with a button on it. As soon as the clien press the button a thread is launch, and inmediatlly then, there is a Response.Redirect like this:

protected void Button1_Click(object sender, EventArgs e)
{
    BL.Class1 cd = new BL.Class1();
    cd.Run(); // or cd.AsyncRun();
    Response.Redirect("~/WebForm2.aspx",true);
}

Of course evrything should be nonstatic. Bussiness Logic class looks somthing like this:

 public class Class1
 {
    public int Signal = 0;
    // non blocking Run... the webserver continues with this process running backwards
    public void RunAsync()
    {
        Signal = 0;
        new System.Threading.Thread(() =>
        {
            System.Threading.Thread.Sleep(100000); // simulate heavy task!
        }
        ).Start();
        Signal = 1;
    }

    // blocking Run...
    public void Run()
    {
        Signal = 0;
        System.Threading.Thread.Sleep(100000); // simulate heavy task!
        Signal = 1;
    }
}

With this in mind, here is the discussion: - In WebForm2.aspx I would like to pool either from the client (javascript/ajax/nonstatic webservice) or the server to the client (registerscript with scriptmanager), in order to have the "Signal" variable set to "True" after the heavy process.. and tell the user (via a div with red background to green color) or something else. - If so, how would be the best method if I do not want to use SignalR or Node.js or WebApi or WebSockets jet? - Do you have any document, book where to explain such situation in an MVC project approach?

All communitty, really thanked on helping within this issue.

br,

1 Answer 1

1

Sounds like a simple meta refresh would do the trick, or a JavaScript that reloads the page on a set interval - no need for anything fancy if you don't want to.

Simply render the page (server-side) either with a red or a green div depending on the completion status of the heavy job.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.