Disable cache in Silverlight HttpWebRequest
- by synergetic
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.