• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 518
  • Last Modified:

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
0
chanteroc
Asked:
chanteroc
1 Solution
 
lengreenCommented:
Hi

Your log file isn't getting held in the viewstate is it? If it is then disable it for preLogFile as you may be posting this back to the server. Other that that ?????? :)

Cheers

Len
0
 
chanterocAuthor Commented:
Len,

Thank you much; that was the ticket!

John
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now