开发者

ASP.NET C# Sending Information Back to Client While Processing Web Page

开发者 https://www.devze.com 2022-12-13 05:45 出处:网络
Not sure if I\'ll explain this properly but here goes. I having written an asp.net app using C# for the code behind. After the user makes some selection and hits the \"run\" button I pass off the proc

Not sure if I'll explain this properly but here goes. I having written an asp.net app using C# for the code behind. After the user makes some selection and hits the "run" button I pass off the processing to a dll writ开发者_StackOverflowten in C# but what I want is a way to periodically send information back to the client so they can see what's going on like how many records have been processed and things like that. How can I accomplish this?

thanks


Have a look at Provide feedback to the user on Long Running Tasks – using loader image - MS AJAX and JQuery

Also: How Do I: Use the ASP.NET AJAX UpdateProgress Control?


There are many ways of accomplishing this kind of task. I am presenting a few ideas

Solution 1:

You can use Ajax Timer Control.

Solution 2:

Make a Windows Service that will read the information and will interact with the asp.net application to notify about the requested information. It will act as a background worker.

Hope this helps


This may have been my wording of the question but I found what I was looking for. You can use the HttpResponse.Flush method to achieve what I was trying to do.


This is often called HTTP Server Push or HTTP Streaming or Long Polling. Depending on how it's done.

You can also check out this SO question on HTTP Streaming...

Cross-browser implementation of "HTTP Streaming" (push) AJAX pattern

Or this one with an example of Long Polling

How do I implement basic "Long Polling"?

https://stackoverflow.com/questions/tagged/long-polling

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号