简体   繁体   中英

Why a simple POST takes too long?

I am running tests on a site which will be online next week and i have a strange situation.

On this page i have 4 Tabs where 'Prezentare' is loaded by Default. Well, i do not understand why, when i press on 'Descopera' the POST to the server takes 6 seconds !!! (used firebug to investigate) Please note that no queries are running behing that POST only a div is hidden and another is made visible...

Do you have any clue?

I have a dedicated server: Single core AMD Athlon 64 3700+ 2 GB

Thanks in advance...

Edit: the tabs are within an update panel and the Tabs' names are link buttons which OnClick event show the corresponding div and hide the others

Code for Tabs:

<asp:UpdatePanel runat="server" ID="updatePanelTabs">
    <ContentTemplate>
        <div class="tab-content">
            <ul class="meniu prezentare" runat="server" id="ulTabs">
                <li>
                    <asp:LinkButton OnClick="lnkTab_Click" ID="lnkPrezentare" runat="server">Prezentare
                 </asp:LinkButton>
                </li>
                <li>
                    <asp:LinkButton OnClick="lnkTab_Click" ID="lnkRecenzie" runat="server">Recenzie
                 </asp:LinkButton>
                <li>
                    <asp:LinkButton OnClick="lnkTab_Click" ID="lnkComentarii" runat="server">Comentarii
                 </asp:LinkButton>
                </li>
                <li>
                    <asp:LinkButton OnClick="lnkTab_Click" ID="lnkDescopera" runat="server">Descopera
                 </asp:LinkButton>
                </li>
// other code
</ContentTemplate>
</asp:UpdatePanel>

What OnClick method is doing:

 protected void lnkTab_Click(Object sender, EventArgs e)
    {
        LinkButton lnkPressed = (LinkButton)sender;
        switch (lnkPressed.ID.ToString())
        {
            case "lnkPrezentare":
                {
                    ulTabs.Attributes.Add("class", "meniu prezentare");
                    hideRestTabs("lnkPrezentare");
                    break;
                }
            case "lnkRecenzie":
                {
                    ulTabs.Attributes.Add("class", "meniu recenzie");
                    hideRestTabs("lnkRecenzie");
                    break;
                }
            case "lnkComentarii":

                {
                    ulTabs.Attributes.Add("class", "meniu comentarii");
                    hideRestTabs("lnkComentarii");
                    break;
                }
            case "lnkDescopera":
                {
                    ulTabs.Attributes.Add("class", "meniu descopera");
                    hideRestTabs("lnkDescopera");
                    break;
                }
        }
    }

UPDATE: It seems that it depends on internet connection for me. I have friends which tested and for they the "switching tabs" takes 1.5 s...

看看是否有机会在asp.net源代码中使用System.Threading.Thread.Sleep()来测试ajax请求?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM