Results 1 to 26 of 26

Thread: slow performance

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2005
    Posts
    31

    slow performance

    Hi All,

    I inherited the VB .Net application. Its performance is not great - it takes 8-10 sec to go page to page. I did some time debugging and it takes about 7 seconds to hit the Page_Init after clicking on MoveNext button. Any ideas what could cause this?

    Thanks,
    Gina

  2. #2
    Frenzied Member dj4uk's Avatar
    Join Date
    Aug 2002
    Location
    Birmingham, UK Lobotomies: 3
    Posts
    1,131

    Re: slow performance

    Maybe it's just tired

    Would be useful to have some code to look at my psychic skills are playing up today!

    DJ

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Feb 2005
    Posts
    31

    Re: slow performance

    Since the problem happens somewhere before PageInit and PageLoad what is running at that time? What code would you like to look at?
    Thanks!

  4. #4
    Frenzied Member dj4uk's Avatar
    Join Date
    Aug 2002
    Location
    Birmingham, UK Lobotomies: 3
    Posts
    1,131

    Re: slow performance

    Hang on is this a VB.Net windows application or an ASP.NET web application?

    DJ

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Feb 2005
    Posts
    31

    Re: slow performance

    It's written in VB.Net and ran on the web server as it's our intranet application.

  6. #6
    Frenzied Member dj4uk's Avatar
    Join Date
    Aug 2002
    Location
    Birmingham, UK Lobotomies: 3
    Posts
    1,131

    Re: slow performance

    Ok just checking it was an ASP.NET web application.

    Could you post one of the aspx pages for us to view to try and work out what is happening.

    DJ

  7. #7
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704

    Re: slow performance

    If its running slow in debug mode through the IDE (f5)... that's normal.

    If its slow after you hit it typing a url into your web browser ... that's not.

  8. #8

    Thread Starter
    Junior Member
    Join Date
    Feb 2005
    Posts
    31

    Re: slow performance

    Hi nemaroller,

    Unfortunatly it's running slow in the server not in the debug mode. My user is sick and tired of waiting to flip from page to page.

    Hi dj4uk,

    Here is part (otherwise it's too long) of the aspx page.

    Thanks a lot guys!


    <%@ Register TagPrefix="uc1" TagName="Header" Src="controls/Header.ascx" %>
    <%@ Page Language="vb" AutoEventWireup="false" Codebehind="BasicInfo.aspx.vb" Inherits="Services.BasicInfo"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <title>BasicInfo</title>
    <meta content="Microsoft Visual Studio.NET 7.0" name="GENERATOR">
    <meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
    <meta content="JavaScript" name="vs_defaultClientScript">
    <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
    </HEAD>
    <body bgColor="ghostwhite" MS_POSITIONING="GridLayout">
    <form id="Form1" method="post" runat="server">
    <TABLE id="Table3" style="Z-INDEX: 101; WIDTH: 760px; POSITION: absolute" cellSpacing="0"
    cellPadding="0" border="0">
    <TR>
    <TD><uc1:header id="Header" runat="server"></uc1:header></TD>
    </TR>
    <TR>
    <TD>&nbsp;&nbsp;</TD>
    </TR>
    <TR>
    <TD><asp:label id="LabelTitle" style="Z-INDEX: 100; LEFT: 250px; POSITION: absolute" runat="server"
    ForeColor="HotTrack" Font-Size="small" Font-Bold="True">BASIC INFORMATION</asp:label></TD>
    </TR>
    </TABLE>
    <TABLE id="Table1" style="Z-INDEX: 102; LEFT: 40px; WIDTH: 669px; POSITION: absolute; TOP: 120px"
    cellSpacing="4" cellPadding="0" width="369" border="0">
    <TR>
    <TD><asp:label id="Label2" runat="server" Width="106px"> Name</asp:label>
    <asp:textbox id="TextBox_Name" tabIndex="1" runat="server" Width="300px" MaxLength="50"></asp:textbox>
    <asp:label id="Label44" runat="server" Width="50px">ID</asp:label>
    <asp:textbox id="TextBox_ID" tabIndex="1" runat="server" Width="38px" Enabled="False" BackColor="LavenderBlush"></asp:textbox>
    </TD>
    <asp:regularexpressionvalidator id="rev_Name" runat="server" ErrorMessage="Name character(s) not accepted."
    ValidationExpression="[A-Za-z0-9&amp;'\/ ,.-]+" Display="None" ControlToValidate="TextBox_Name"></asp:regularexpressionvalidator>
    </TR>
    <aspanel id="pnl_ContactInfo" Runat="server">
    <TR>
    <TD>
    <asp:label id="Label13" runat="server" Font-Bold="True" Font-Size="X-Small" Width="106px" Font-Italic="True">Contact Name 1</asp:label>
    <asp:textbox id="TextBox_Salutation" tabIndex="4" runat="server" Width="50px" MaxLength="24"></asp:textbox>
    <asp:textbox id="TextBox_FirstName" tabIndex="5" runat="server" Width="112px" MaxLength="40"></asp:textbox>
    <asp:textbox id="TextBox_MI" tabIndex="6" runat="server" Width="48px" MaxLength="1"></asp:textbox>
    <asp:textbox id="TextBox_LastName" tabIndex="7" runat="server" Width="178px" MaxLength="40"></asp:textbox></TD>
    </TR>
    <TR>
    <TD>
    <asp:label id="Label42" runat="server" Width="106px">Job Title</asp:label>
    <asp:textbox id="TextBox_JobTitle" tabIndex="13" runat="server" Width="400px" MaxLength="3"></asp:textbox></TD>
    </TR>
    <TR>
    <TD>
    <asp:label id="Label4" runat="server" Width="106px">Phone Number</asp:label>
    <asp:label id="Label9" runat="server">&nbsp;&nbsp;Ext&nbsp;</asp:label>
    <asp:textbox id="TextBox_Phone_Extension" tabIndex="15" runat="server" Width="62px" MaxLength="5"></asp:textbox></TD>
    </TR>
    <TR>
    <TD>
    <asp:label id="Label5" runat="server" Width="106px">Fax Number</asp:label> <asp:textbox id="TextBox_FAX_Number" tabIndex="17" runat="server" Width="112px" MaxLength="7"></asp:textbox>&nbsp;
    <asp:label id="Label18" runat="server" Width="45px">E-mail</asp:label>
    <asp:textbox id="Textbox_EmailAddress" tabIndex="18" runat="server" Width="176px" MaxLength="9"></asp:textbox></TD>
    <asp:regularexpressionvalidator id="rev_FaxArea" runat="server" ControlToValidate="TextBox_FAX_AreaCode" Display="None"
    ValidationExpression="[0-9 -]+" ErrorMessage="FAX number character(s) not accepted."></asp:regularexpressionvalidator>
    </TR>
    <TR style="HEIGHT: 5px">
    <TD
    &nbsp;&nbsp;
    <asp:label id="Label11" runat="server" Font-Size="XX-Small">Salutation</asp:label>&nbsp;&nbsp;&nbsp;
    <asp:label id="Label19" runat="server" Font-Size="XX-Small">First Name</asp:label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:label id="Label22" runat="server" Font-Size="XX-Small">M.I.</asp:label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;
    <asp:label id="Label23" runat="server" Font-Size="XX-Small">LastName</asp:label></TD>
    </TR>
    <TR>
    <TD>
    <asp:label id="Label25" runat="server" Font-Bold="True" Font-Size="X-Small" Width="106px" Font-Italic="True">Contact Name 2</asp:label>
    <asp:textbox id="TextBox_FirstName2" tabIndex="5" runat="server" Width="112px" MaxLength="40"></asp:textbox>
    <asp:textbox id="TextBox_MI2" tabIndex="6" runat="server" Width="48px" MaxLength="1"></asp:textbox>
    <asp:textbox id="TextBox_LastName2" tabIndex="7" runat="server" Width="178px" MaxLength="40"></asp:textbox></TD>
    </TR>
    <TR>
    <TD>
    <asp:label id="Label43" runat="server" Width="106px">Job Title</asp:label>
    <asp:textbox id="TextBox_JobTitle2" tabIndex="13" runat="server" Width="400px" MaxLength="3"></asp:textbox></TD>
    </TR>
    <TR>
    <TD style="HEIGHT: 23px">
    <asp:label id="Label26" runat="server" Width="106px">Phone Number</asp:label>
    <asp:textbox id="TextBox_Phone_AcreaCode2" tabIndex="13" runat="server" Width="50px" MaxLength="3"></asp:textbox>
    <asp:textbox id="TextBox_Phone_Number2" tabIndex="14" runat="server" Width="112px" MaxLength="7"></asp:textbox>
    <asp:label id="Label27" runat="server">&nbsp;ext&nbsp;</asp:label>
    <asp:textbox id="TextBox_Phone_Extension2" tabIndex="15" runat="server" Width="62px" MaxLength="5"></asp:textbox></TD>
    <asp:regularexpressionvalidator id="rev_PhoneArea2" runat="server" ControlToValidate="TextBox_Phone_AcreaCode2"
    Display="None" ValidationExpression="[0-9 -]+" ErrorMessage="Phone number character(s) not accepted."></asp:regularexpressionvalidator>
    <asp:regularexpressionvalidator id="rev_Phone2" runat="server" ControlToValidate="TextBox_Phone_Number2" Display="None"
    ValidationExpression="[0-9 -]+" ErrorMessage="Phone number character(s) not accepted."></asp:regularexpressionvalidator>
    <asp:regularexpressionvalidator id="rev_PhoneExt2" runat="server" ControlToValidate="TextBox_Phone_Extension2" Display="None"
    ValidationExpression="[0-9 -]+" ErrorMessage="Phone number character(s) not accepted."></asp:regularexpressionvalidator></TR>
    <TR>
    <TD>
    <asp:label id="Label39" runat="server" Width="106px">FAX Number</asp:label>
    <asp:textbox id="TextBox_FAX_AreaCode2" tabIndex="16" runat="server" Width="50px" MaxLength="3"></asp:textbox>
    <asp:textbox id="TextBox_FAX_Number2" tabIndex="17" runat="server" Width="112px" MaxLength="7"></asp:textbox>&nbsp;
    <asp:label id="Label40" runat="server" Width="45px">e-Mail</asp:label>
    <asp:textbox id="Textbox_EmailAddress2" tabIndex="18" runat="server" Width="176px" MaxLength="9"></asp:textbox></TD>
    <asp:regularexpressionvalidator id="rev_FaxArea2" runat="server" ControlToValidate="TextBox_FAX_AreaCode2" Display="None"
    ValidationExpression="[0-9 -]+" ErrorMessage="FAX number character(s) not accepted."></asp:regularexpressionvalidator>
    <asp:regularexpressionvalidator id="rev_Fax2" runat="server" ControlToValidate="TextBox_FAX_Number2" Display="None"
    ValidationExpression="[0-9 -]+" ErrorMessage="FAX number character(s) not accepted."></asp:regularexpressionvalidator></TR>
    </aspanel>
    <TR>
    <TD>&nbsp;&nbsp;</TD>
    </TR>
    <TR>
    <TD style="HEIGHT: 61px"><asp:label id="Label37" runat="server" Width="88px" Height="45px">Comments</asp:label>
    <asp:textbox id="TextBox_Comments" tabIndex="34" runat="server" Width="440px" MaxLength="255"
    Height="70px" Wrap="True"></asp:textbox></TD>
    </TR>
    <TR>
    <TD>&nbsp;&nbsp;
    </TD>
    </TR>
    <TR>
    <TD>
    <HR style="Z-INDEX: 103; WIDTH: 109.19%; POSITION: absolute" width="109.19%" color="#4b92d9"
    noShade SIZE="7">
    </TD>
    </TR>
    <TR>
    <TD><asp:button id="Button_ClearFields" style="Z-INDEX: 114; LEFT: 322px" tabIndex="32" runat="server"
    ForeColor="White" Font-Bold="True" Width="132px" Text="Clear Fields" BorderWidth="5px" BorderStyle="Outset"
    BackColor="Desktop"></asp:button><asp:button id="Button_Delete" style="Z-INDEX: 114; LEFT: 322px" tabIndex="32" runat="server"
    ForeColor="White" Font-Bold="True" Width="132px" Text="Delete" BorderWidth="5px" BorderStyle="Outset" BackColor="Desktop"></asp:button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<as p:button id="Button_Save" tabIndex="31" runat="server" Font-Bold="True" ForeColor="White"
    Width="132px" Text="Save/Next>" BackColor="Desktop" BorderStyle="Outset" BorderWidth="5px"></asp:button></TD>
    </TR>
    <TR>
    <TD>&nbsp;&nbsp;
    </TD>
    </TR>
    <asp:validationsummary id="ValidationSummary1" runat="server" ShowMessageBox="True" ShowSummary="False"></asp:validationsummary></TABLE>
    </form>
    </body>
    </HTML>

  9. #9
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704

    Re: slow performance

    Step 1:
    Change all <asp:label> tags to <SPAN> tags (and ditch the runat="server" attribute for all these spans).

    The only time you need to have a runat="server" is if you have conditional logic toward that element. So if you wanted to change the text of the label on the backside depending on a user choice (or hide the label itself), you would run it at server, where code-behind logic could inspect the choice and change the label text, or mark the element invisible. In short, if the text never changes - and the control is always visible, change the label to a generic html <span>.

    Changing from asp:label to a span also helps trim viewstate.. (which I imagine yours is quite large). Viewstate must be parsed and inspected on each request - even postbacks.

    Step 2:
    Post your code-behind , because thats where most of the performance difference can be gained.

  10. #10
    Frenzied Member dj4uk's Avatar
    Join Date
    Aug 2002
    Location
    Birmingham, UK Lobotomies: 3
    Posts
    1,131

    Re: slow performance

    Yeah the code behind would be useful.

    Have you tried running it in trace mode? - this gives you timings for operations - you never know there might be something glaringly obvious.

    DJ

  11. #11
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464

    Re: slow performance

    Quote Originally Posted by nemaroller
    Step 1:
    Change all <asp:label> tags to <SPAN> tags (and ditch the runat="server" attribute for all these spans).

    The only time you need to have a runat="server" is if you have conditional logic toward that element. So if you wanted to change the text of the label on the backside depending on a user choice (or hide the label itself), you would run it at server, where code-behind logic could inspect the choice and change the label text, or mark the element invisible. In short, if the text never changes - and the control is always visible, change the label to a generic html <span>.

    Changing from asp:label to a span also helps trim viewstate.. (which I imagine yours is quite large). Viewstate must be parsed and inspected on each request - even postbacks.

    Step 2:
    Post your code-behind , because thats where most of the performance difference can be gained.
    That will only cut about 1/10 of a second off the page load, not really worth the effort unless he has millions of people showing up at the site every month. There are only 20 label controls on that page. That is pretty small and not worth worrying about yet.

    He is talking 6-7 seconds for a page to post and come back, which means that the server is probably overloaded. Sure, if the code behind is doing some wacky stuff, that could be the problem, but my guess is the server is way overloaded, or there is some huge database work or something happening in the code behind.

  12. #12

    Thread Starter
    Junior Member
    Join Date
    Feb 2005
    Posts
    31

    Re: slow performance

    Hi Guys! Thank you so much for looking at my code and giving me great suggestions. I'm in NJ for couple of days and won't be able to connect to my app until Monday. I'll post some VB code then - however, as I mentioned before the delay happens somewhere before it hits the PageLoad. I'll also try changing labels to SPAN as I am willing to try everything at this point.

    How can I run it in trace mode (I've never done it before...) As far as server oveload... I have couple of more apps running on the same web server but they don't give any performance problem. Initially I thought that it may be the db connection/script issue but it looks like the delay happens before it even connects to the database.

    Have a great weekend!
    Gina

  13. #13

    Thread Starter
    Junior Member
    Join Date
    Feb 2005
    Posts
    31

    Re: slow performance

    Hi Guys! I am back at the office. Replacing LABEL with SPAN didn't improve much of the performance. In my WebConfig I added:

    <trace enabled="true" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true" />

    Here is what I got back:

    No. Time of Request File Status Code Verb
    1 3/8/2005 2:12:25 PM /List.aspx 200 GET View Details
    2 3/8/2005 2:12:37 PM /List.aspx 302 POST View Details
    3 3/8/2005 2:12:44 PM /BasicInfo.aspx 200 GET View Details
    4 3/8/2005 2:12:48 PM /BasicInfo.aspx 302 POST View Details
    5 3/8/2005 2:12:48 PM /ApprovedProducts.aspx 200 GET View Details

    List.aspx is the initial/first page in the app and BasicInfo is the second. These are the two pages I'm having performance problems with. I pasted below the trace detail for the List.aspx 302 POST. I've never used Trace before, could you please advise?

    Category Message From First(s) From Last(s)
    aspx.page Begin Init
    aspx.page End Init 0.000081 0.000081
    aspx.page Begin LoadViewState 0.000110 0.000029
    aspx.page End LoadViewState 0.000352 0.000242
    aspx.page Begin ProcessPostData 0.000373 0.000021
    aspx.page End ProcessPostData 0.016914 0.016541
    aspx.page Begin ProcessPostData Second Try 5.676209 5.659295
    aspx.page End ProcessPostData Second Try 5.738690 0.062481
    aspx.page Begin Raise ChangedEvents 5.738803 0.000113
    aspx.page End Raise ChangedEvents 5.738850 0.000047
    aspx.page Begin Raise PostBackEvent 5.738894 0.000044

  14. #14
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704

    Re: slow performance

    Step 2.

    Post your code.

  15. #15

    Thread Starter
    Junior Member
    Join Date
    Feb 2005
    Posts
    31

    Re: slow performance

    Option Explicit On

    Imports System.IO
    Imports System.Text
    Imports System.Data
    Imports System.Data.SqlClient
    Imports System.Diagnostics
    Imports Services.DBAccess
    Imports Services.ProductGroups

    Public Class TPABasicInfo
    Inherits System.Web.UI.Page

    Private oConfigurationInformation As ConfigurationInformation
    Private oDBAccess As DBAccess
    Private oProductGroups As ProductGroups

    Dim drTPAA As DataRow
    Protected WithEvents tbRegion As System.Web.UI.WebControls.TextBox
    Private htPgRegions As Hashtable
    Private htPgSalesC As Hashtable

    Dim ID As String
    Protected WithEvents TextBox_Name As System.Web.UI.WebControls.TextBox

    blah-blah------------

    #Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
    'CODEGEN: This method call is required by the Web Form Designer
    'Do not modify it using the code editor.
    InitializeComponent()
    End Sub

    #End Region

    Private Class SalesConsultant
    Public Name As String
    Public RegionCode As Integer
    Public RegionText As String
    Public Producer_Id As Integer
    End Class


    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    On Error GoTo Fctn_Error
    Dim sErr As String

    Dim sUserName As String
    Dim sUserLogonId As String
    sUserLogonId = Request.ServerVariables("LOGON_USER")
    If sUserLogonId.Length < 1 Then
    Response.Clear()
    Response.Status = "Unauthorized"
    Response.AddHeader("WWW-Authenticate", "NTLM")
    Response.End()
    End If
    If InStr(sUserLogonId, "\") <> 0 Then
    sUserLogonId = Mid(sUserLogonId, InStr(sUserLogonId, "\") + 1)
    End If

    Dim sAppPhyPath As String = Request.PhysicalApplicationPath()
    oConfigurationInformation = New ConfigurationInformation(sAppPhyPath)

    sUserName = oConfigurationInformation.GetApplicationUsers(sUserLogonId.ToLower())
    If IsNothing(sUserName) Then
    Response.Redirect("NotAValidUser.aspx")
    End If
    If sUserName.Length < 1 Then
    Response.Redirect("NotAValidUser.aspx")
    End If

    Dim sUserRights As String = oConfigurationInformation.GetApplicationUsersRights(sUserLogonId.ToLower())
    If sUserRights.IndexOf("w") < 1 Then
    Response.Redirect("List.aspx")
    End If

    oDBAccess = New DBAccess(oConfigurationInformation)

    oProductGroups = New ProductGroups(oDBAccess, oConfigurationInformation)

    drTPAA = Nothing
    TPAA_ID = ""
    If IsNothing(Session("List_TPAAid")) Then
    ' error
    Else
    TPAA_ID = CType(Session("List_TPAAid"), String)
    If TPAA_ID = "0" Then
    LabelTitle.Text = "NEW"

    drTPAA = oDBAccess.GetTopRow()
    drTPAA("first_name") = ""
    blah-blah---------------
    Else
    drTPAA = oDBAccess.GetName(TPAA_ID)
    End If
    End If

    If IsPostBack() Then

    Else

    If Not IsNothing(drTPAA) Then

    TextBox_first_name.Text = drTPAA("first_name")
    blah-blah-----------------

    End If
    End If

    Fctn_Error:
    sErr = Err.Description
    End Sub

    end class

    PLEASE LET ME KNOW IF YOU NEED TO SEE SOME OTHER CODE AS WELL. THANKS!

  16. #16
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704

    Re: slow performance

    Can you just upload that code file? Its hard to see it all in perspective otherwise.

  17. #17
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704

    Re: slow performance

    You know I just realized you said it takes 7 seconds to break at the PAGE_INIT function. That's really messed up. Is the Move Next button posting back to this page?

    Btw, I organized your code a little...(left out the designer generated code)

    VB Code:
    1. Option Explicit On
    2. Imports System.Data
    3. Imports System.Data.SqlClient
    4. Imports System.Diagnostics
    5. Imports System.IO
    6. Imports System.Web
    7. Imports System.Web.UI
    8. Imports System.Text
    9.  
    10. Imports Services.DBAccess
    11. Imports Services.ProductGroups
    12.  
    13.  
    14. Public Class TPABasicInfo
    15.     Inherits System.Web.UI.Page
    16.  
    17.     Private htPgRegions As Hashtable
    18.     Private htPgSalesC As Hashtable
    19.  
    20.     Private oConfigurationInformation As ConfigurationInformation
    21.     Private oDBAccess As DBAccess
    22.     Private oProductGroups As ProductGroups
    23.  
    24.     Protected WithEvents LabelTitle As System.Web.UI.WebControls.Label
    25.     Protected WithEvents tbRegion As System.Web.UI.WebControls.TextBox
    26.     Protected WithEvents TextBox_first_name As System.Web.UI.WebControls.TextBox
    27.  
    28.     Private Class SalesConsultant
    29.         Public Name As String
    30.         Public RegionCode As Integer = -1
    31.         Public RegionText As String
    32.         Public Producer_Id As Integer = -1
    33.     End Class
    34.  
    35.  
    36.     Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _
    37.      Handles MyBase.Load
    38.  
    39.         Dim drTPAA As DataRow
    40.         Dim sErr As String
    41.         Dim sUserName As String
    42.         Dim sUserLogonId As String
    43.         Dim sAppPhyPath As String
    44.         Dim sUserRights As String
    45.         Dim TPAA_ID As String
    46.  
    47.         Try
    48.  
    49.             sUserLogonId = Request.ServerVariables("LOGON_USER")
    50.  
    51.             If sUserLogonId.Length < 1 Then
    52.                 Response.Clear()
    53.                 Response.Status = "Unauthorized"
    54.                 Response.AddHeader("WWW-Authenticate", "NTLM")
    55.                 Response.End()
    56.             End If
    57.  
    58.             If InStr(sUserLogonId, "\") <> 0 Then
    59.                 sUserLogonId = Mid(sUserLogonId, InStr(sUserLogonId, "\") + 1)
    60.             End If
    61.  
    62.             sAppPhyPath = Request.PhysicalApplicationPath()
    63.             oConfigurationInformation = New ConfigurationInformation(sAppPhyPath)
    64.  
    65.             sUserName = oConfigurationInformation.GetApplicationUsers(sUserLogonId.ToLower())
    66.  
    67.             If IsNothing(sUserName) Then Response.Redirect("NotAValidUser.aspx")
    68.  
    69.             If sUserName.Length < 1 Then Response.Redirect("NotAValidUser.aspx")
    70.  
    71.             sUserRights = oConfigurationInformation.GetApplicationUsersRights(sUserLogonId.ToLower())
    72.  
    73.             If sUserRights.IndexOf("w") < 1 Then Response.Redirect("List.aspx")
    74.  
    75.             oDBAccess = New DBAccess(oConfigurationInformation)
    76.             oProductGroups = New ProductGroups(oDBAccess, oConfigurationInformation)
    77.  
    78.             drTPAA = Nothing
    79.             TPAA_ID = String.Empty
    80.  
    81.             If IsNothing(Session("List_TPAAid")) Then
    82.                 ' error
    83.                 Throw New ApplicationException("Some type of error")
    84.             Else
    85.                 TPAA_ID = CType(Session("List_TPAAid"), String)
    86.                 If TPAA_ID = "0" Then
    87.                     LabelTitle.Text = "NEW"
    88.  
    89.                     drTPAA = oDBAccess.GetTopRow()
    90.                     drTPAA("first_name") = String.Empty
    91.  
    92.                 Else
    93.                     drTPAA = oDBAccess.GetName(TPAA_ID)
    94.                 End If
    95.             End If
    96.  
    97.             If IsPostBack() Then
    98.             Else
    99.                 If Not IsNothing(drTPAA) Then TextBox_first_name.Text = drTPAA("first_name")
    100.             End If
    101.  
    102.         Catch ex As Exception
    103.  
    104.             sErr = ex.Message
    105.  
    106.         End Try
    107.  
    108.     End Sub
    109.  
    110. End Class
    Last edited by nemaroller; Mar 9th, 2005 at 06:51 PM.

  18. #18

    Thread Starter
    Junior Member
    Join Date
    Feb 2005
    Posts
    31

    Re: slow performance

    Thank you so much Nemaroller for taking your time to help me.. Yes, the MoveNext button is posting back to the current page before it goes on to the next one. Right now I have a suspicion that the way the front page was designed maybe the clue to the performance issue. I'd like to show you the code to get your opinion. How can I upload the code file for your review?

    Ginab

  19. #19
    Frenzied Member dj4uk's Avatar
    Join Date
    Aug 2002
    Location
    Birmingham, UK Lobotomies: 3
    Posts
    1,131

    Re: slow performance

    Submit a reply and add an attachment to it. You can only attach certain file types so you may have to put your files into a zip file.

    HTH

    DJ

  20. #20

    Thread Starter
    Junior Member
    Join Date
    Feb 2005
    Posts
    31

    Re: slow performance

    The code attached has been created by someone to build a table to display about 600 rows in the first page of the app. The PageLoad is calling the BuildTable() function in the attachment. Since the performance is slow for only first and second pages I suspect that this fucnction could have been designed better ( I maybe wrong). It goes thru the function to load the first page and second (since the MoveNext button is posting back to the current page before hitting the PageLoad of the 2nd page). Please advise. I appreciate your help a lot!

    Ginab
    Attached Files Attached Files

  21. #21

    Thread Starter
    Junior Member
    Join Date
    Feb 2005
    Posts
    31

    Re: slow performance

    Just following up.... Thanks!

  22. #22

    Thread Starter
    Junior Member
    Join Date
    Feb 2005
    Posts
    31

    Re: slow performance

    Hi dj4uk and nemaroller!

    I attached the code file about a week ago. Could you please help?

    Thanks

    Gina

  23. #23
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704

    Re: slow performance

    Seems the original author has viewstate enabled for each table cell... and if you figure approximately 15 cells per row * 600 rows = the viewstate for this page is TOO big.

    There is also a lot of unnecessary code in there - the storecell function assign enableviewstates to true - a total of 3 times for the same object.

    I will have a look at this code after in more detail. Send the code for the ENTIRE PAGE - not just the suspect function, otherwise there could be something screwy in the page_load and we would never have known about it.

  24. #24

    Thread Starter
    Junior Member
    Join Date
    Feb 2005
    Posts
    31

    Re: slow performance

    Thanks again for you help Nemaroller! As you had asked I attached the entire code for the first page. On the buttom of the attachment I included the function from another page that deals with retrieving/updating the data. This function selects the data that is displayed in the page. I'll be reducing the number of cells displayed in each row to about 4-5.

    Thanks,
    Gina
    Attached Files Attached Files

  25. #25
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704

    Re: slow performance

    I don't envy you - that code is all over the place - there should be some extensive refactoring done.

    The StoreCell function passes datarows via value rather than reference - which means it is instantiating a datarow object within the function, then returning that object to the caller. It would probably help some to pass that byref instead.

    The GetPPANames function should call a stored procedure which you should have created in the database. Using dynamic sql for such a common use is a performance hit.

  26. #26

    Thread Starter
    Junior Member
    Join Date
    Feb 2005
    Posts
    31

    Re: slow performance

    Thanks Nemaroller! I'll incorporate your suggestions and see what happens!

    Gina

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width