Click here to Skip to main content
Sign Up to vote bad
good
See more: C#
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
 
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 15 Jan '13 - 23:28
Edited 15 Jan '13 - 23:38
ridoy22.7K

Comments
ramnath_k - 16 Jan '13 - 5:41
yes message box not displayed and radio buttion not changed

3 solutions

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.
  Permalink  
Comments
ramnath_k - 17 Jan '13 - 0:50
thank you
You missed the important lesson during your asp.net web development course.
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.
  Permalink  
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
 
<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/[^]
  Permalink  

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 425
1 OriginalGriff 315
2 Slacker007 240
3 Aarti Meswania 210
4 Maciej Los 200
0 Sergey Alexandrovich Kryukov 8,893
1 OriginalGriff 7,134
2 CPallini 3,678
3 Rohan Leuva 3,036
4 Maciej Los 2,428


Advertise | Privacy | Mobile
Web03 | 2.6.130516.1 | Last Updated 16 Jan 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid