Click here to Skip to main content
15,905,028 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,
the below is used to clear the cache in asp.net, but i required the same code in silverlight using c#,



Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.Now.AddSeconds(1));
Response.Cache.SetNoStore();

can anyone provide code for my requirement.
thanks and regards,
vijay.
Posted

1 solution

Hi,

The below article explains how to avoid XAP file catching in Silverlight.

http://geekswithblogs.net/mbcrump/archive/2011/01/06/prevent-your-silverlight-xap-file-from-caching-in-your-browser.aspx[^]
 
Share this answer
 
Comments
vijay4mgvrm 28-Feb-12 3:08am    
Hi,
I tried Below Code In My Silver light Application Like:
<body >
<form id="form1" runat="server" style="height:100%">
<div id="silverlightControlHost">
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
<%
string strSourceFile = @"ClientBin/SilverlightApplication2.xap";
string param;
if (System.Diagnostics.Debugger.IsAttached)
param = "<param name=\"source\" value=\"" + strSourceFile + "\" />";
else
{
string xappath = HttpContext.Current.Server.MapPath(@"") + @"\" + strSourceFile;
DateTime xapCreationDate = System.IO.File.GetLastWriteTime(xappath);
param = "<param name=\"source\" value=\"" + strSourceFile + "?ignore="
+ xapCreationDate.ToString() + "\" />";
}
Response.Write(param);
%>
<param name="onError" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="4.0.50826.0" />
<param name="autoUpgrade" value="true" />

<img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/>

</object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe></div>
</form>
</body>

Now I Executed My Application But When I am Clicking On Browser Back Button,it
Displayed Old Viewed Pages.
Is Need To Write Code Any Where Other Than That Code?
Please Give Me Some Idea How I Prevent Browser Back Button In Silver Light.

Thanks And Regards,
Vijay.
Jaganathan Bantheswaran 28-Feb-12 4:26am    
It is not based on silverlight. Google for disabling Browser back button in asp.net.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900