silverlight 4, getting html cookies

痞子三分冷 提交于 2019-12-11 05:17:11

问题


In Fiddler 2, Raw data shows the following cookies:

__utma_a2a=7477768302.1349257957.1317701031.1318843147.1318844585.14;   
 session="3YZAdX/xEuKVpYZWKBmcbC2S1YE=?
_flashes=KGxwMQooUydtZXNzYWdlJwpTJ0xvZ2dlZCBpbicKdHAyCmEoUydtZXNzYWdlJwpTJ0xvZ2dlZCBp
bicKdHAzCmEoUydtZXNzYWdlJwpTJ0xvZ2dlZCBpbicKdHA0CmEoUydtZXNzYWdlJwpTJ0xvZ2dlZCBpbicKd
HA1CmEoUydtZXNzYWdlJwpTJ0xvZ2dlZCBpbicKdHA2CmEoUydtZXNzYWdlJwpwNwpTJ0xvZ2dlZCBpbicKcD
gKdHA5CmEu&
_fresh=STAxCi4=&_id=UycwO0BAXHhlY1x4MTlceDA3LSBceGI1XHhlOVx4OWRceGQ3MFx4MTVceGIyJwpwMQou&
user_id=VjMKLg=="

(actually no space in between except after semicolon;)

But in Silverlight client

string[] cookies = System.Windows.Browser.HtmlPage.Document.Cookies.Split(';');

gets only 1 entry to the semicolon. All starting 'session' isn't in there. How can I get whole cookie string?


回答1:


Observe the HTTP conversation again in Fiddler and take not of the earlier response that contains the Set-Cookie header that sets the session cookie in the first place.

I suspect that cookie will have the "httpOnly" directive which means that it can not be retrieved by client code, it will be excluded by the standard APIs that expose cookies to script (or in this case Silverlight) code.



来源:https://stackoverflow.com/questions/8090917/silverlight-4-getting-html-cookies

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!