Reputation: 69
I have web app with asp.net web forms, there is a button that makes a postback. Event handler of this button executes in cycle some operations and on each iteration it makes html. How can I return this hmlm to the client on every iteration
public void button_click(object sender, EventArgs)
{
foreach(var item in some_collection)
{
Var html = generateHtml();
//here i want to return html to client and add to dom
}
}
How can I redesign this method? Maybe use tasks, async or something else?
UPDATE: I've decided to use ASP.NET SignalR. It's very powerful framework to solve my problem
Upvotes: 0
Views: 65
Reputation: 11963
You simply can't. Http is stateless meaning that it throws away all the user's connection information once it is done sending back the result. Your best bet would be to make some Web API methods and use javascript ajax call to retrieve the html. If you want to include user specific information/settings then include those in the cookie
Upvotes: 1