Updating Content during intense processing in asp

Reply Forum
Forum postRoman @ 2011-07-06 20:48:06
ReplyReply to
I have been trying to figure out how to update content within an asp page while other processing is going on. What I am looking for is similar to a progress bar, but instead of a progress bar I am using a stream reader to display a log file within a listbox control on the screen.

I have tried an ajax timer mixed with an update panel, but that code does not execute until the page renders. I'm wondering if there is a way to use threading to do this. I am currently working on trying to use a BackgroundWorker on a multithreaded page to update an update panel. What I am getting is similar to trying to use a timer, the BGworker seems to do it's job properly, but the display does not update until the page is rendered. Any ideas would be greatly appreciated

--Roman


Forum postRoman @ 2011-07-07 18:22:19
ReplyReply to
Well, I can see this is an active forum. . .

Either way, I fixed my problem. The truth is the way I was doing this was wrong to start with. A better way to approach this is to simply not run intense processing from asp. The way I did it was to create a console application that ran my 'intense processing' part of the program. Then I simply started my console application from the website and began to display the log. This is a much better option. Running your console application from code is as simple as the following line:

System.Diagnostics.Process.Start("c:\\Path\\file.exe", "args in string form");

The problem with the above option, is that you have to set your permissions properly to allow your web site to execute an exe file. Another approach, which is a little bit safer would be to drop the console application method and to start the application using a windows service. Again, permissions will need to be set to allow this within IIS, Apache, or whatever else you are using.

The major advantage I have found to going console application is that the file which is run clears out memory after it completes execution. For me this is good because I was working with a third party sdk which has memory leak issues. When the processing is complete, the exe exits, and the memory reserved for that exe clears. That would not be the case with a windows service which would need to have the service restarted to clear out the memory.

The way I handled logging is by creating a streamwriter and using it to create a log within my console application. Next I read that same log within my website and displayed the contents in a list box. That way, when my screen refreshed I was able to update the processing which was completed on the server within my listbox in semi real time. Hope this helps someone someday

--Roman


Forum postJohn @ 2011-08-20 08:53:55
ReplyReply to
http://www.4microsoftsolutions.com/category/AspNet.aspx











© net-tutorials.com 2006 - 2012

MailContact net-tutorials.com