Code Simplified – Viral Sarvaiya

Code Simplified – Viral Sarvaiya, Web Developer Friends, dot net Developer, Sql Server Developer

Prevent Silverlight XAP file from caching in your browser.

Posted by Viral Sarvaiya on January 19, 2012

Sometime when we deploy silverlight project, that happen often that when you run website it run older deploy project. because that comes from the cache,

so clear the cache of the Browser and some time that problem occur also after clearing cache.

so for that we have to force website to download new version of xap file every time when it run.

normally we have tag for XAP file, as like below

<param name="source" value="/ClientBin/SilverApp.xap" />

but we have to download our XAP file new at every run of site.

so there so many option for that.

1) changing the Assembly and File version numbers

2) GUID value for the project

but, here is the simple and best solution for that and then it worked like a charm everytime.

<param name="source" value="/ClientBin/SilverApp.xap?ignoreme=<%=System.DateTime.Now.ToUniversalTime()%>" />

Enjoy,

Advertisements

One Response to “Prevent Silverlight XAP file from caching in your browser.”

  1. Nice article viral

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: