Solved

visual studio uses old version of javascript file

Posted on 2010-09-06
10
971 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
 

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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

706 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now