Fixed Issue #522 Silverlight Caching of negotiate #531

Merged
merged 5 commits into from Jul 19, 2012
@@ -36,7 +36,12 @@ public Task<NegotiationResponse> Negotiate(IConnection connection)
internal static Task<NegotiationResponse> GetNegotiationResponse(IHttpClient httpClient, IConnection connection)
{
- string negotiateUrl = connection.Url + "negotiate";
+#if SILVERLIGHT || WINDOWS_PHONE
+ string negotiateUrl = connection.Url + "negotiate?" + GetNoCacheUrlParam();
+#else
+ string negotiateUrl = connection.Url + "negotiate";
+#endif
+
return httpClient.GetAsync(negotiateUrl, connection.PrepareRequest).Then(response =>
{
@@ -116,9 +121,18 @@ protected string GetReceiveQueryString(IConnection connection, string data)
.Append(customQuery);
}
+#if SILVERLIGHT || WINDOWS_PHONE
+ qsBuilder.Append("&").Append(GetNoCacheUrlParam());
+#endif
return qsBuilder.ToString();
}
+ private static string GetNoCacheUrlParam()
+ {
+ //Updated to Ticks according to Samual Jack's comment
+ return "noCache=" + DateTime.Now.Ticks.ToString();
+ }
+
protected virtual Action<IRequest> PrepareRequest(IConnection connection)
{
return request =>