Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
We have C# web application ,on button click event we do a data load process using stored procedure which runs for 3 hours,after the procedure finish loading we display a message box using code

C#
ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), scriptString, true); and turn radiobuttion.SelectedIndex = 2;


if the procedure completes in 1 hour things are fine,if it runs for more than 2 hours ,the page turns unresponsive(message box not displayed, radio button not changed),i tried debugged the code, the code process through all lines and completes with no display,can anyone help
Posted
Updated 15-Jan-13 23:38pm
v2
Comments
ramnath_k 16-Jan-13 5:41am    
yes message box not displayed and radio buttion not changed

There is a large fundamental flaw in your application logic at play here. Web applications are really horrible at dealing with long running processes. In this case a 1 to 3 hour wait for response is ridiculous for a web app. When running a long process like this, you should be firing off a worker thread to do this and your notification to the client should be that the process has started. As long as this worker thread is working, your page should just recognize this and tell the user that. When the process completes there should be a more direct notification system in place. Perhaps an email or log entry noting that the process is complete. My personal preference on this is the following:

1) User initiates long running process.
2) Server receives the postback and fires off a thread to begin the long running process.
3) Server response is a notification page that the process is currently running.
4) User hits page again.
5) Server receives request and checks if there is already a long running process executing.
a) If the process is running then server response is the notification that the process is currently running.
b) If no, then send the actual page back.
 
Share this answer
 
Comments
ramnath_k 17-Jan-13 0:50am    
thank you
You missed the important lesson during your asp.net web development course.
C#
ScriptManager.RegisterStartupScript
is for 'registering' the javascript method on the page and is NOT for 'calling/executing' a method.

Read here...
http://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanager.registerstartupscript.aspx[^]
http://msdn.microsoft.com/en-us/library/bb359558.aspx[^]
http://msdn.microsoft.com/en-us/library/bb359558.aspx[^]

You need some polling mechanism from your client which checks the status of your 'long running process' and then accordingly shows/hides the message box.
 
Share this answer
 
I think this happen because of the request timeout. most probably your web site set request timeout for 1hr.
Because of the timeout response will not getting to the page. (registers script will not rendering)

please check the web.config file following section and modify accordingly

HTML
<system.web>
    <httpruntime executiontimeout="3600">        
</httpruntime></system.web>


And please check the following also

http://codebetter.com/petervanooijen/2006/06/15/timeout-of-an-asp-net-page/[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900