Webpage has expired error message after back button to page with ToolkitScriptManager Issue: A .net webpage containing only the following items (or more) ajaxtoolkit:ToolkitScriptManager asp:Button asp:HyperLink When you click the button, the page posts back. If you then click the hyperlink you are redirected to another page. If you click the back button, you would expect to be redirected back to the page (you have caching set correctly). This works if you remove the ToolkitScriptManager. However, what actually happens, if the ToolkitScriptManager is on the page, is you get the following error message after clicking the browser's Back button: "Webpage has expired Most likely cause: ???The local copy of this webpage is out of date, and the website requires that you download it again. Something to try: Click on the Refresh button on the toolbar to reload the page. After refreshing, you might need to navigate to the specific webpage again, or re-enter information." Possible Solutions: Option 1. Remove the ToolkitScriptManager. Presumably you do not want to do this, because you are using it for an AJAX control. Option 2. Put the button and other necessary content in an asp:UpdatePanel. This will resolve the issue. Problem: Now you have an UpdatePanel on the page. You will have to build it properly and make sure it meets your needs. UpdatePanels can have unexpected side effects. So on to Option 3... Option 3. Get rid of the ToolkitScriptManager! It is slow, buggy and bloated anyway. You can use a normal scriptManager, and then add the reference to any .js ajax scripts you are missing. A very easy way to do this is in .NET 3.5+, using the new CombineScripts option. Here are the scripts required just to run the AutoCompleteExtender: <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="false" ScriptMode="Release" LoadScriptsBeforeUI="false"> <CompositeScript> <Scripts> <asp:ScriptReference Name="MicrosoftAjax.js" /> <asp:ScriptReference Name="MicrosoftAjaxWebForms.js" /> <asp:ScriptReference Name="Compat.Timer.Timer.js" Assembly="AjaxControlToolkit, Version=4.1.7.1213, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" /> <asp:ScriptReference Name="Common.Common.js" Assembly="AjaxControlToolkit, Version=4.1.7.1213, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" /> <asp:ScriptReference Name="ExtenderBase.BaseScripts.js" Assembly="AjaxControlToolkit, Version=4.1.7.1213, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" /> <asp:ScriptReference Name="AutoComplete.AutoCompleteBehavior.js" Assembly="AjaxControlToolkit, Version=4.1.7.1213, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" /> <asp:ScriptReference Name="PopupExtender.PopupBehavior.js" Assembly="AjaxControlToolkit, Version=4.1.7.1213, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" /> </Scripts> </CompositeScript> </asp:ScriptManager>
Created By: amos 3/10/2014 12:53:07 PM Updated: 3/11/2014 4:48:20 PM
|
|