Solved

visual studio uses old version of javascript file

Posted on 2010-09-06
10
973 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

914 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

21 Experts available now in Live!

Get 1:1 Help Now