我刚刚将Silverlight应用程序中的ServiceStack程序集从4.0.9升级到4.0.20。
似乎新版本不会保留cookie。 JsonServiceClient创建如下:
return new JsonServiceClient(this._address.ToString()) { StoreCookies = true, ShareCookiesWithBrowser = false };
(如果我指定ShareCookiesWithBrowser则无关紧要)
当我向Fiddler查询时,我对/ auth的初始POST请求的响应如下:
HTTP/1.1 200 OK
Cache-Control: no-store,must-revalidate,no-cache,max-age=0
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8
Vary: Accept
Server: Microsoft-HTTPAPI/2.0
Set-Cookie: ss-id=5cwF1pftMI0R2LphJMjr;path=/
Set-Cookie: ss-pid=KnLVQCQtQe9pvBilJBXU;path=/;expires=Sun, 14 May 2034 13:34:03 GMT
Set-Cookie: X-UAId=;path=/;expires=Sun, 14 May 2034 13:34:03 GMT
X-Served-By: XY Server/2014.1.0 (rev 0) RC1 - XYServer
X-Powered-By: ServiceStack/4,020 Win32NT/.NET
Date: Wed, 14 May 2014 13:34:03 GMT
但是我做的下一个请求看起来像这样:
GET http://localhost:8082/api/server/info HTTP/1.1
Accept: application/json, */*
Accept-Language: nl-NL
Referer: http://localhost:4637/ClientBin/ServerManagerLite.xap
Accept-Encoding: identity
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; InfoPath.3; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; rv:11.0) like Gecko
Host: localhost:8082
DNT: 1
Connection: Keep-Alive
我在这里错过了必不可少的代码吗?
更新:这已在版本4.0.21中修复
谢谢, Robert van Drunen
答案 0 :(得分:1)
更新:这已在版本4.0.21中修复