tags:

views:

33

answers:

2

Question: I have a web interface where a user can upload an XML file, which then gets imported into a SQL database.

Import works fine, interface works fine, logfile works fine. The problem: The user doesn't get any progress report until the entire file has been processed...

Is there any way the server can output logfile messages to the user page while processing? I mean AJAX doesn't work for server side calls to the client, only vice-versa, or is there a workaround ?

+1  A: 

Have you looked at thee articles? might be of some help

Reverse Ajax Using Hidden IFrame and Using Server Push (aka Reverse AJAX)

Edit: We have a similar question too : asp.net http server push to client

Shoban
Argh, I tried that... worked fine with FF and Chrome, but IE has bugs that crash it after appx. 1000 lines of JS...
Quandary
+1  A: 

If you set response.Buffer to false, anything written to the response will be sent to the client immediately rather than sending everything waiting for the response to end.

This works best with text output of course - I use this approach for displaying server console output in the browser. To integrate it with an html page, you would use jquery to post the file to a page that returns only text, and set up a data received handler to update the ui as messages come through on the text file.

Tom Clarkson
Very slow for a large logfile. I realized I needed to put the logfile into the database, with timestamps. Then, you can just write a .ashx handler which you can query for messages/status/updates/finished.
Quandary