2

I'm working on a site which has a toolkitscriptmanager in the master page. My problem lies when navigating to a page which performs a server.transfer. I'm actually also using url redirects, but from what I can tell, that doesn't have any bearing on the problem.

If I change code to Response.Redirect, the page redirects fine, but that's not the functionality I'm looking for, I need to keep the SEO friendly urls.

For example - say in the code of Page1.aspx there's a Server.Transfer to Page2.aspx. What I've diagnosed, is that the Script Manager adds a script reference to the page your'e browsing. So, If I were to navigate straight to Page2.aspx, The script added is

<script src="/Page2.aspx?_TSM_HiddenField_=ctl00_ctl00_ToolkitScriptManager1_HiddenField... etc

However, with the Server.Transfer, it's trying to find

<script src="/Page1.aspx?_TSM_HiddenField_=ctl00_ctl00_ToolkitScriptManager1_HiddenField... etc

How can I tell the ScriptManager to use the final destination for the script file? I've been researching trying to use some magic setting in the TSM but no luck so far.

JonK
  • 622
  • 7
  • 13

1 Answers1

2

After some digging and testing, I was able to get this to work. I had to move my scripts defined in the head into the TSM, and make use of the CompositeScripts:

<act:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" CombineScripts="false">
            <CompositeScript>
                <Scripts>
                    <asp:ScriptReference Path="/js/jquery.1.4.2.min.js" />
                    <asp:ScriptReference Path="/js/jquery-ui.1.8.5.min.js" />
                    <asp:ScriptReference Path="/js/jlEmbed.js" />
                </Scripts>
            </CompositeScript>
        </act:ToolkitScriptManager>

What I find stringe is if I set CombineScripts=true, the TSM would compile all the js files into its own internal script - and then still place the script referencing the page it's on. By turning CombineScripts=false, it still compiles the js files, does them individually, and also does so for the page script reference.

JonK
  • 622
  • 7
  • 13