Solved

visual studio uses old version of javascript file

Posted on 2010-09-06
10
982 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

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…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
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…

738 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