Solved

visual studio uses old version of javascript file

Posted on 2010-09-06
10
978 Views
Last Modified: 2012-05-10
When my code hits my javascript file, it uses an old version (before I made recent changes). The page in debugger is titled: WebResource.axd?d=...[dynamic][read only].

It is not the current .js file I have saved with my application.

How do I fx this?
0
Comment
Question by:XTO
10 Comments
 
LVL 82

Assisted Solution

by:leakim971
leakim971 earned 150 total points
ID: 33612943
Check this : http://stackoverflow.com/questions/206783/when-does-browser-automatically-clear-javascript-cache

You need to add a virtual random and useless parameter at the end of the source name.
0
 
LVL 7

Expert Comment

by:Inteqam
ID: 33614823
add a dummy query string with a dummy value to the URL of the JS file.
0
 
LVL 14

Assisted Solution

by:Dhanasekaran Sengodan
Dhanasekaran Sengodan earned 150 total points
ID: 33615733
Here is a little trick I like to use if I make a big change to a javascript file that I know will cause problems for people who have it cached:

Whenever I include a script in a page, I use the following format:

<script type="text/javascript" src="myscript.js?ver=1"></script>

Now, when the user views this page, they cache 'myscript.js?ver=1'. Whenever I want to force the user to reload a new and improved javascript file, I change the url to 'myscript.js?ver=2'. The browser doesn't use the cache, because it can't find the file, and it caches 'myscript.js?ver=2' for the next time they visit the page.
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:XTO
ID: 33620501
In the OnPreRender event of my class I had the following code:

string scriptLocation =
                    Page.ClientScript.GetWebResourceUrl(this.GetType(), "querySections.querysection.js");

I changed querysection.js to querysection2.js . That didn't work.

I tried, querysection2.js?ver=123. That didn't work.

I hard coded into my .aspx page:
<script type="text/javascript" src="/queryAbstracts/querySection.js?ver=1"></script>

That didn't work either.
The browser is still reverting to the old version.


0
 
LVL 7

Expert Comment

by:Inteqam
ID: 33622726
something is wrong. this should work.
0
 
LVL 7

Expert Comment

by:Inteqam
ID: 33622731
are you caching the page? the full page?
0
 

Author Comment

by:XTO
ID: 33622755
I think I might have figured out what the problem is. My main project's bin directory has references to the projects, one of which contains the javascript file. I'm guessing that the DLL referenced in the BIN directory contains the old javascript file. Is that possible?
I may just need to update the DLL references in the BIN directory. I'll play around with that and see how that works.
0
 
LVL 7

Accepted Solution

by:
Inteqam earned 200 total points
ID: 33622792
very possible.

but building the solution should build new DLLs

try to clear the solution out and rebuild it
0
 

Author Comment

by:XTO
ID: 33629499
I was copying the DLL out of the project and copying it to the BIN folder of the main project. Rebuilding the page, I guess, was building the DLL in the original project and not the one copied to the BIN folder.
0
 

Author Closing Comment

by:XTO
ID: 33629539
The above answers did not pertain to my situation, but they did increase my knowledge so I feel that they deserve some points.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question