Link to home
Start Free TrialLog in
Avatar of chanteroc
chanteroc

asked on

Response.Redirect Slow as Molasses

Hello all,

I'm running into an issue which for the moment is more of an annoyance than anything else, but I was hoping you might shed some light on why it's happening.

I have a Web Form that does nothing other than display a log file in a pre tag's innner text. The page pulls in the contents of the log file just fine, but when the user clicks on the LinkButton, which should return the app to the Main Menu, the page appears to hang and then times out after 90 seconds or so.

Page code follows:

using RCP.Utilities;
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.IO;
using System.Web.UI.WebControls;

namespace RCP
{
      /// <summary>
      /// Summary description for RecordsCenters.
      /// </summary>
      public class ProcessViewLog : System.Web.UI.Page
      {
            #region Variables and Controls

            protected Footer ucFooter1;
            protected Footer ucFooter2;
            protected AdminHeader ucAdminHeader;
            protected System.Web.UI.HtmlControls.HtmlForm Form1;
            protected System.Web.UI.WebControls.Label lblLogFile;
            protected System.Web.UI.WebControls.Label lblHeader;
            protected System.Web.UI.HtmlControls.HtmlGenericControl preLogFile;

            #endregion
      
            #region Page_Load()

            private void Page_Load(object sender, System.EventArgs e)
            {
                  if (! IsPostBack)
                  {
                        lblLogFile.Text = AdminProcess.GetLastProcessLog();

                        if (File.Exists(@lblLogFile.Text))
                        {
                              string @tempFile = ConfigurationSettings.AppSettings["RootFolder"] + "temp.log";
                              File.Copy(@lblLogFile.Text, @tempFile, true);
                              StreamReader fs = new StreamReader(@tempFile);
                              preLogFile.InnerText = fs.ReadToEnd();
                              fs.Close();
                              File.Delete(@tempFile);
                        }
                        else
                        {
                              preLogFile.InnerText = "The Log File " + @lblLogFile.Text + " was not found.";
                        }
                  }
            }

            #endregion

            #region Web Form Designer generated code
            override protected void OnInit(EventArgs e)
            {
                  //
                  // CODEGEN: This call is required by the ASP.NET Web Form Designer.
                  //
                  InitializeComponent();
                  base.OnInit(e);
            }
            
            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            private void InitializeComponent()
            {    
                  this.Load += new System.EventHandler(this.Page_Load);

            }
            #endregion

      }
}

Many thanks!

John
ASKER CERTIFIED SOLUTION
Avatar of lengreen
lengreen

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of chanteroc
chanteroc

ASKER

Len,

Thank you much; that was the ticket!

John