Wriju's BLOG

.NET, Cloud and everything

WinJS.xhr Issue while running next time

Windows 8 and WinJS.xhr goes hand in hand while developing application to consume web. I was trying out something like that. It used to work fine for the first run. But the second and consecutive runs it gives error as below.


Error message

Exception is about to be caught by JavaScript library code at line 2351, column 21 in ms-appx://microsoft.winjs.1.0/js/base.js

0x800c0008 – JavaScript runtime error: The download of the specified resource has failed.

If there is a handler for this exception, the program may be safely continued.

I had to delete the bin\debug to run it. This is not possible in installed application and this error was causing my application failure.

I got an elegant solution to get rid of this issue. Somehow it was caching the page and due to which I was getting error at base.js file which I cannot edit.

So I have added the code to disable the cache

return WinJS.xhr({
            url: url1,
            headers: { "Cache-Control": "no-cache", "If-Modified-Since": "Mon, 27 Mar 1972 00:00:00 GMT" }