[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 623
  • Last Modified:

AJAX: Best way to refresh ScriptManager script references

Hi there,
I have a master page that has a ScriptManager on it. On the script manager I register script files like on the snippet. However, when I make a change on one of the files, I have to delete all internet temporary files and restart my web server for the changes to be taken into account. Does some have a more efficient option that doesn't oblige me to sacrifice my temporary internet files?
<asp:ScriptManager ID="ScriptManager1" runat="server">
            <Scripts>
                <asp:ScriptReference Path="~/script1.js" />
            </Scripts>
        </asp:ScriptManager>

Open in new window

0
karakav
Asked:
karakav
  • 3
  • 2
  • 2
4 Solutions
 
kadabaCommented:
Not sure how to append the time stamp in asp but

give a shot by including the timestamp

<asp:ScriptReference Path="~/script1.js?timestamphere" />

so it would look something like

<asp:ScriptReference Path="~/script1.js?20090703123455" />

0
 
karakavAuthor Commented:
I am afraid I can't use that code because what I need is a manual refresh, not a dynamic one.
0
 
amit_gCommented:
Generally versioning is used for this kind of situation. So

<asp:ScriptReference Path="~/script1_v1.00.js" />

later after the update increment the version

<asp:ScriptReference Path="~/script1_v1.01.js" />

again

<asp:ScriptReference Path="~/script1_v1.10.js" />

and so on.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
kadabaCommented:
Yes that's correct. Although I do not think its necessary to change i every time manually in the code.

I am not sure how exactly in asp, but in a jee app, I have a property which will indicate the buildstamp and this will change each time a new build is taken... hence my suggestion of time stamp.[ I use something like date format say 200911212121234] so for each day if the build increases i increase this value which is as good as what was mentioned above.

perhaps a property in web.config or something should be enough to take care of this.


0
 
karakavAuthor Commented:
Does it mean that whenever I make a modification to the javacript file I have to create a new file with the version name?
0
 
amit_gCommented:
Yes, that way it would be guaranteed that the old JS that would be cached by the browser is not used. While you are developing and testing, you don't need to increment the version, just clear the cache of your browser but once in production, you should use versioning.
0
 
karakavAuthor Commented:
Thanks.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now