Why couldn't I effectively refresh my aspx page in VS.NET when debugging? (clearing Javascript cache

K

Ken Fine

I wrote a small aspx page that used RegisterStartupScript and StringBuilder
to display a bunch of nodes on a windows live local map. This involved a lot
of client-side JS script. I got the dreaded "Operation Aborted" error in IE7
which has been discussed to death on places like this:
http://mapki.com/index.php?title=FAQs. I resolved that error with a bit of
reading and tinkering. That solution appears below for anyone that needs it.

*However*, the fixed page would NOT work when I attempted to test it in
VS.NET's internal browser(IE). It DID work when I uploaded it to my
production server and fired up IE. VS.NET's browser uses IE internally, from
what I understand. I'm guessing this was some kind of caching issue. It is
troublesome to debug client-side code when you aren't sure whether you're
looking at the "freshest" code or not. I am wondering why this happened and
if there is a way to force VS.NET to show you exactly what you've been
coding.

I am using the Visual Studio 2008 beta and love it (I don't think this is a
beta issue.)

###
The solution to the issue I mentioned in p1. Copied from my work blog:
###
Avoiding "Operation Aborted" error with mapping and IE7

This comes up particularly often if you're using
Page.ClientScript.RegisterStartupScript and Stringbuilder to inject
client-side code to a webpage, especially in various mapping applications
like "Windows Live Local" and Google maps.

The issue is that IE7 does not like you screwing around with the DOM before
the page has completely rendered.

I don't have a complete understanding of every consideration, but I do know
that the steps below worked for my app.

Steps:

1) Wrap your map rendering stuff as a function:

string myScript = "<script type='text/javascript'>function AddPin [function
code here] function mapthis() { [call map rendering function and tack on a
bunch of nodes using StringBuilder] ";
Page.ClientScript.RegisterStartupScript(this.GetType(), "myscript",
myScript);

2) In the head of your webpage, define a function that will call the
function embedded in the StringBuilder:

function OnLoadPage(){ mapthis(); }

3) Call OnLoadPage(); with the body tag:

4) Test by uploading to a server, NOT in VS.NET. VS.NET appears to cache and
it won't be obvious when you've fixed your page.
 
S

Steven Cheng[MSFT]

Hi Ken,

From your description, you're encoutering some problem when try developing
and debugging an asp.net web page(with scripts) in Visual Studio IDE,
correct?

As for the problem, is it reproable in a simple project also or is specific
to that project? As you mentioned that the problem could be caused by
browser cache, then, you can try disable client cache and let browser
always request newer version when visiting page through the following steps:

** open IE, start "tools-->Internet Options" menu

** choose "General" tab(default)

** click the "setting" button in "browsing history" section

** in the opened dialog, you can find the "Check for newer versions of
stored pages , images and medias for .......", yo can set it to "Every time
I visit the web page.

If you have any other finding, please also feel free to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.
 
S

Steven Cheng[MSFT]

Hi Ken,

How are you doing and any progress on this issue? If there is still
anything we can help, please feel free to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top