In this case my personal advice is to use simple ajax request
In example you may call a first load call where it will take care to initialize task
Save in session a values to this task in example fantasy name Session("taksprogress")="0"
and you will update your progress bar with this value
Second one start a timer on page which check each five second and report the update cheking only your actual status of session("taskprogress").
When it will return a value defined by you at that point you will be show your message to client side.
It will help you more and it really simple to achive.
Take care to remember that if you will use an ashx file you must enable right permission to accesso in read/write mode to session.
There are many other way to do it with classes, json response which include text messages and so on :)
I hope that can help you to choose the right way to choose.
Hi Shiva, as per your last comment is better choose ajax in this case assume this situation :
- button "START" to make ajax call to .aspx/ashx(i preferr it) which takes care to run long task
- button "CANCEL" which will be used to make another ajax call to stop the long task
- progress bar which will be updated with some info
- At this point you need to make some javascript function to handle your need to update progress bar and so on.
In example you will have one call to start the task on to stop the taks one to retrive status you can assume that in your ashx file you can pass many parameters as per your need in example
http://domain.com/ajax/longtask.ashx?task=start
http://domain.com/ajax/longtask.ashx?task=update
http://domain.com/ajax/longtask.ashx?task=cancel
in this case you can use one single ajax call to do all the stuff and facing the task called you may use a switch case in javascript to elaborate.
You have also to create one single function to enable timer to call services at defined interval like 2 second 1 second 5 second
When task will run (task=start) it will update session with new values and with update you only retrieve this data from session too
In case of task cancel you will set a flag in session to say to your procedure to exit and return the result which via ajax in json format
that's all
checking your logic, construct and classes to be sure that you can implement this logi in simple manner.You can also create a custom class in example MonitoringLongTask which expose several information and so each time you need to communicate/retreve you only need to update "MonitoringLongTask" class properties.
I hope it can help you
UPDATE ON YOUR LAST COMMENT :
Not sure to understand Siva, did you means that you post some data from a form and then evaluation could run?? no prob same stuff or better 2 different ajax call nothing else.First ajax call send data to database and elaborate it and return ok or failed within the success function into ajax call call your second fucntion which start the task to bind both calls you may create a custom token to pass to the first response wich will be added to second call in example : firt call http://domain.com/ajax/lng.ashx?task=store¶m1=0¶m2=1 etc etc it will return a simple token in example a guid or id taken from database for this particular task and pass it as parameter in 2 call like http://domain.com/ajax/lng.ashx?task=start&uid=yourtoken