Code Simplified – Viral Sarvaiya

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

Posts Tagged ‘XAP’

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

Posted in .Net, ASP.NET, Silverlight | Tagged: , , , , , , , , , | 1 Comment »

Get Silverlight XAP and Hosting Page URL

Posted by Viral Sarvaiya on December 5, 2011


Get the URL to the current xap file:
App.Current.Host.Source.AbsoluteUri

Sample:
http://www.WebsiteName.com/ClientBin/SilverlightApplicationName.xap

Get the full URL of the page hosting the xap (with QueryStrings):
HtmlPage.Document.DocumentUri.ToString()

Sample:
http://www.WebsiteName.com/SilverlightApplicationName.aspx?param=1

Posted in .Net, ASP.NET, Silverlight, Visual Studio | Tagged: , , , , , | Leave a Comment »

 
%d bloggers like this: