Disable cache in Silverlight HttpWebRequest
Posted
by synergetic
on Stack Overflow
See other posts from Stack Overflow
or by synergetic
Published on 2010-06-12T08:53:27Z
Indexed on
2010/06/12
9:03 UTC
Read the original article
Hit count: 680
My Silverlight4 app is hosted in ASP.NET MVC 2 web application. I do web request through HttpWebRequest class but it gives back a result previously cached. How to disable this caching behavior? There are some links which talks about HttpWebRequest in .NET but Silverlight HttpWebrequest is different. Someone suggested to add unique dummy query string on every web request, but I'd prefer more elegant solution. I also tried the following, but it didn't work:
_myHttpWebRequest.BeginGetRequestStream(new AsyncCallback(BeginRequest), new Guid());
In fact, by setting browser history settings it is possible to disable caching. See the following link: http://stackoverflow.com/questions/3027145/asp-net-mvc-with-sql-server-backend-returns-old-data-when-query-is-executed But asking a user to change browser settings is not an option for me.
© Stack Overflow or respective owner