I'm running a Silverlight out-of-browser desktop application that downloads a bunch of images from an HTTP server. It seems as though Silverlight has a local image cache that it uses for the images, even across multiple instantiations of the application. If I update an image on the HTTP server, I would like the updated image to be displayed in the Silverlight application, rather than the version of the image stored in the Silverlight image cache. How do I go about clearing the image cache on my machine?
Clearing my web browser's image cache doesn't work here because the Silverlight application is running as an out-of browser desktop application.
Note: I'm not interested in clearing the cache programmatically, I want to be able to do this by either changing a setting on my machine (to disable the image cache) or deleting a directory where the images are stored.
To clear the Silverlight cache, use the following steps:
1) Start up the Silverlight application of interest
2) Right click anywhere inside the application and click ‘Silverlight’
3) Click on the “Application Storage” Tab
4) Choose the application (website) of interest and click "Delete..."
-or-
4) Click "Delete All" to delete the cache for all Silverlight applications
If you don't want applications to ever cache, clear the "Enable application storage" checkbox, but this is not necessarily recommended.
http://www.microsoft.com/getsilverlight/resources/documentation/AppStorage.aspx
Apparently you are correct. It is broken.
Found this link which may explain the problem and a workaround: Caching of, in, and around your Silverlight application (part 1)
Related
If my asp.net website has some silverlight content(XAP file, silverlight video content), does user have to download all content everytime he open my website in browser, or date stay saved/cached on Hard Drive even if user turn of computer? In what folder data is saved and how long does it stay saved? I read somewhere about "Reduce XAP size by using application library caching" option when creating silverlight project. Is that option enabled by default(Don't have Silverlight installed in VS)?
I recommend on reading up on Silverlight and XAP caching here. In short, yes, the Silverlight XAP is cached and only re-loaded when the XAP has been modified or your browser's cache has been cleared.
The browser will cache resources, libraries, xaml, and binaries needed to run the application. This is handled by the browser cache and your files are stored in the temporary internet files directory.
Assembly caching allows your assemblies to be cached by the browser separately from your XAP file. The benefit of this is that you can update your XAP and the browser not have to re-download your assemblies, just the updated XAP file. This can make a big difference in downloads speeds when users re-visit your site.
Sometimes, caching a XAP file can work against you as publishing an update doesn't necessarily dirty the cache. IE handles updates better than Chrome and Firefox. The link above shows you how to configure IIS to immediately expire the web content on publish. This CodeProject link also has a good method for updating the ASP.NET page content with a dynamic string to force a cache refresh on publish.
As we all know very well..
whenever we create application inside silverlight it is asking us for hosting it
by dialogue box at given below.
My question is what if i unchecked the check box[Host the silverlight application in a new web site].
Means what kind of problem we have to face later if I don't host our Silverlight Application in any of the option given by dialogue box.
Basically it is not a problem at all. You can add a website at any time later.
In the project settings of a website there is a Silverlight tab. Under that you will find the option to add Silverlight projects to the website. This will setup the links to generate the XAP in ClientBin as well as giving you the option to create test pages for each Silverlight app added. The test pages will give you the sample JS you need to host your Xap later.
You will have to eventually host your application somewhere otherwise it will stay on your local harddrive and hardly reach any clients. So if you have an existing web site you could simply copy-paste the necessary javascript to this site later in order to embed your Silverlight application. In this case you can uncheck this checkbox.
I have an Silverlight application that uses ssl to communicate with the site-of-origin. The application loads a number of images from a separate server (running apache under port 81 without ssl). The images are regular png's. The images from the Apache machine are not loaded properly, i.e. the image control remains blank. When I post the same image on my app server (i.e. site-of-origin), and modify the link accordingly, the images are displayed properly. This link on MSDN says that images are media are excluded from access-restriction policies.
Would appreciate any suggestions.
I hope you are deploying your Silverlight application to a web server and not running it using the Visual Studio development server. I had a similar problem with images when I was using the built in development web server. You can find about my experience here.
It might help if you subscribe to ImageFailed event and post the stacktrace.
You are running into cross-scheme access restrictions in silverlight, see table at the bottom of http://msdn.microsoft.com/en-us/library/cc189008(v=vs.95).aspx
One possible solution is to load image using WebClient and call SetSource on image element. That is what we do in our app. In fact we wraped it into custom image control that hides all annoying details.
I have a WPF intranet app running in Trusted mode (local only).
I would like the users to be able to upload an image and attach it to an article on my newsletters section. I am having trouble deciding where these images will be stored.
Please provide me with your opinions.
At present I have a few ideas myself;
I could have an aspx page that runs parallel to this app, and run this inside a browser(I-frame). This page could then handle the upload and display of the image.
I could also, have the users copy directly to a network share.
It seems that there should be a more elegant sollution that I am not aware of.
Any ideas?
Don't force the solution towards ASPX just because you know how to do it there. It's unnatural to build a page, host browser to show that page etc, just so you could upload an image.
It's actually quite simpler to do it in a desktop client than on web page. You have a "Load File Dialog" - use that to get to the filepath the user wants to upload, and when you have that you can either:
copy it (inside your application) to your share,
or if you have a service - send it through some method call,
or you can even store it inside a database (recommended if the files are small)
There's really lots of options here... it depends if your client has connection to db, do you have service in between, etc...
Inside my Silverlight app, i use reflection to load an assembly. While the app is running, the version and content of that assembly can change. I know the moment, when it changes, now I want to trigger the complete reload of the app, so that assembly is reloaded too with the new version. How to do that?
You can reload the page that hosts the silverlight application, so the application is also reloaded: it's just one line:
System.Windows.Browser.HtmlPage.Document.Submit();
If you have problems with the browser's cache, check out this question:
How do you force Firefox to not cache or re-download a Silverlight XAP file?