Search code examples
asp.netwebformsupdatepanel

UpdatePanel full postback on production server but async on local server


I have a simple ASP.NET 4.0 web form which has an UpdatePanel with a button and TextBox inside. There is nothing unusual about it (it is not inside a repeater and it is not inside a dynamic control).

Asynchronous postback works fine on my test server which is Windows Server 2003.

However, when I copy to my web hosting company (smarterasp.net, Server 2012) it does a full postback. I tried all of the settings available in the hosting control panel but nothing worked (eg. HTTP compression, Integrated mode, output caching).

Are there any usual causes for why this happens on different servers?

<asp:UpdatePanel ID="panSlug" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
        <div class="form-group">
            <asp:Label ID="lblSlug" runat="server" AssociatedControlID="txtSlug" Text="Slug"></asp:Label>
            <div class="input-group">
                <asp:TextBox ID="txtSlug" runat="server" CssClass="form-control" MaxLength="100"></asp:TextBox>
                <span class="input-group-btn">
                    <asp:Button ID="btnSlugSuggest" runat="server" CssClass="btn btn-default" OnClick="btnSlugSuggest_Click" Text="Suggest" />
                </span>
            </div>
            <asp:RequiredFieldValidator ID="valSlug" runat="server" ControlToValidate="txtSlug" Display="None" ErrorMessage="Slug is a required field" ValidationGroup="Product"></asp:RequiredFieldValidator>
            <p class="help-block">Slug is the URL of the product (no spaces or non alpha numeric characters)</p>
        </div>
    </ContentTemplate>
</asp:UpdatePanel>

Looking at the output HTML on the local server the button renders as input type button with an onclick event, whereas on the live server it renders as a submit button with no onclick event.

In Developer Tools console two errors are shown: "ASP.NET Ajax client-side framework failed to load" and "Sys is not defined".


Solution

  • It turns out that I had a page route set in global.asax that was preventing the axd files from loading.

    I was missing routes.Ignore("{resource}.axd/{*pathInfo}"); from global.asax.

    Hopefully this answer will help someone else as another possible solution to problems with UpdatePanels.