locked
Page with validaton very slow in the web server RRS feed

  • Question

  • User-828495923 posted

    This page work perfectly fine on a local machine, but as soon I publish the page is slowing down drasticaly

    <%@ Page Title="Contact Us" Language="C#" MasterPageFile="~/NewMaster.Master" AutoEventWireup="true" CodeBehind="ContactUs.aspx.cs" Inherits="Containers.ContactUs" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
        <%@ Register TagPrefix="recaptcha" Namespace="Recaptcha" Assembly="Recaptcha" %>
         <!--<script type="text/javascript"  src='<%=Request.ApplicationPath + "JavaScript/Helper.js"%>'></script>-->
        <script type="text/javascript" src='<%=ResolveUrl("~/JavaScript/Helper.js") %>'></script> 
        <script type="text/javascript">
    
            
            $(function () {
                countRemChar($("#<%=TxtMessage.ClientID%>"), $('#charStatus'), 1000);
            });
        </script>
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
        <div id = "contactUsSingle">
    
            <asp:Panel ID="PnlContactThisLocation" runat="server" GroupingText="Contact us" DefaultButton="BtnSend" CssClass="pnlStylingContactUs">
                <table style=" width:100%;">
                    <tr><th style="width:15%;">Name:</th><td >
                        <asp:TextBox ID="TxtName" runat="server"  ></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidatorName" runat="server" Text="*" ErrorMessage="Name is required."
                        ControlToValidate="TxtName" CssClass="errors" Display="Dynamic"></asp:RequiredFieldValidator></td></tr>
                    <tr><th>Email:</th><td>
                        <asp:TextBox ID="TxtEmail" runat="server" TextMode="Email"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidatorEmail" runat="server" Text="*" ErrorMessage="Email is required."
                        ControlToValidate="TxtEmail" CssClass="errors" Display="Dynamic"></asp:RequiredFieldValidator>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidatorEmail" runat="server" ErrorMessage="Please enter a valid email." Text="*"
                            ValidationExpression="^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$" ControlToValidate="TxtEmail" Display="Dynamic" CssClass="errors"></asp:RegularExpressionValidator>
                        </td></tr>
                    <tr><th>Phone:</th><td>
                        <asp:TextBox ID="TxtPhone" runat="server" TextMode="Phone"></asp:TextBox>(000-000-0000)
                    <asp:RequiredFieldValidator ID="RequiredFieldValidatorPhone" runat="server" Text="*" ErrorMessage="Phone is required."
                        ControlToValidate="TxtPhone" CssClass="errors" Display="Dynamic"></asp:RequiredFieldValidator>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidatorPhone" runat="server" ErrorMessage="Phone number is not valid." Text="*" ControlToValidate="TxtPhone" CssClass="errors"
                            ValidationExpression="((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}" Display="Dynamic" ></asp:RegularExpressionValidator>
                            </td></tr>
                    <tr><th>Subject</th><td>
                        <asp:TextBox ID="TxtSubject" runat="server"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidatorSubject" runat="server"  Text="*" ErrorMessage="Your subject is required."
                        ControlToValidate="TxtSubject" CssClass="errors" Display="Dynamic"></asp:RequiredFieldValidator><br /> </td></tr>
                    <tr><th>Your message:</th><td>
                        <asp:TextBox ID="TxtMessage" TextMode="MultiLine" runat="server" CssClass="multiLineTextBox"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidatorMessage" runat="server"  Text="*" ErrorMessage="Your message is required."
                        ControlToValidate="TxtMessage" CssClass="errors" Display="Dynamic"></asp:RequiredFieldValidator><br /> </td></tr>
                   </table>
                <p class="reminingCharacters">Max characters 1000  &nbsp; &nbsp; <span id="charStatus"></span></p>
               
                      <div id="reCaptcha"><recaptcha:RecaptchaControl ID="RecaptchaControl1" runat="server" Theme="clean"  
                   PublicKey="*********************" PrivateKey="**********************"/></div>
    
                    <div class="summary">
                        <asp:ValidationSummary ID="ValidationSummary1" runat="server" CssClass="errors"/>
                    </div>
                    
                <div class="clearAll"></div>
    
                    <asp:Button ID="BtnSend" runat="server" Text="Send" OnClick="BtnSend_Click"/>
                
                </asp:Panel>
            
            <asp:Label ID="LblContactUs" runat="server" CssClass="errors" ></asp:Label>
        </div>
    </asp:Content>
    


     .

    Thursday, October 8, 2015 4:45 PM

Answers

  • User475983607 posted

    Lio1972

    I thought that there is nothing wrong with 2 web resources. I do have a similar page with validation and two web resources hosted in GODaddy and it is working fine.

    Again, the page is making a request for a completely different domain than the current page.  That seemed to cause the bottle neck which I assume is due to the framework trying to find and/or build the resources.

    The new link has 61 resources to download.  A browser can open (i believe) 6 connections are at time.  Therefore, you have a blocking situation on every page load especially the first time a client visits the site.  If the site is busy this will translate into slow response times.  Consider optimizing the CSS, Script, and image loading.  For example you have 3 favicons. While the ico files are small it takes 3 connections to download the files and connections are a precious resource.

    Use Developer tools to debug the site.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, October 13, 2015 8:00 AM

All replies

  • User61956409 posted

    Hi Lio1972,

    According to your code, we could find that you are using a third-party control RecaptchaControl, you could try to remove it from your application and check if it make your page slow.

    Besides, you could try to validate user inputs from client side using JavaScript instead of using validator control.

    Best Regards,

    Fei Han

    Thursday, October 8, 2015 10:46 PM
  • User-828495923 posted

    Thank you

    The re captcha control is not slowing down the page. Only the validators. I tested that.

    The strange thing is that sometime the speed is fine and some time is very slow.

    Could somebody give me the idea how can I mimic the summary validator only with javascript.

    Friday, October 9, 2015 9:51 PM
  • User475983607 posted

    The strange thing is that sometime the speed is fine and some time is very slow.

    Validation controls have been around a long time and they're pretty well tested.  

    I suspect you have something else going on.  Have you tried monitoring the server using a tool like performance monitor? Is the server having resource issues?  Is the app pool restarting?

    Saturday, October 10, 2015 7:49 AM
  • User-828495923 posted

    Thank you

    If I remove the validation controls everything is working fine.

    Saturday, October 10, 2015 10:43 AM
  • User475983607 posted

    Thank you

    If I remove the validation controls everything is working fine.

    Again, validation controls have been around a long time and they're well tested.  I would suspect a bug in the code base or a conflicting library.  what happens if you remove Helper.js or any other libraries you've installed?

    Saturday, October 10, 2015 1:24 PM
  • User-828495923 posted

    Thank you

    Apparently  WebResource.axd was loading very slow . What could be the problem?

    My page is a subdomain.

    Monday, October 12, 2015 10:21 AM
  • User475983607 posted

    For some reason you are trying to load 2 web resources from http://www.universaltruckloadinc.com/ which is also causing script errors.

    Take a look at developer tools and the source HTML.

    Monday, October 12, 2015 3:47 PM
  • User-828495923 posted

    Thank you

    I thought that there is nothing wrong with 2 web resources. I do have a similar page with validation and two web resources hosted in GODaddy and it is working fine.

    I created a simple web form page with one textbox, one validator and one button and again there are 2 web resources.

    Monday, October 12, 2015 6:39 PM
  • User475983607 posted

    Lio1972

    I thought that there is nothing wrong with 2 web resources. I do have a similar page with validation and two web resources hosted in GODaddy and it is working fine.

    Again, the page is making a request for a completely different domain than the current page.  That seemed to cause the bottle neck which I assume is due to the framework trying to find and/or build the resources.

    The new link has 61 resources to download.  A browser can open (i believe) 6 connections are at time.  Therefore, you have a blocking situation on every page load especially the first time a client visits the site.  If the site is busy this will translate into slow response times.  Consider optimizing the CSS, Script, and image loading.  For example you have 3 favicons. While the ico files are small it takes 3 connections to download the files and connections are a precious resource.

    Use Developer tools to debug the site.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, October 13, 2015 8:00 AM