I'm developing a Windows Desktop Gadget. From within the gadget, I have to login to an external website, get a response from a specific page and display required information from it.
I have implemented the request using jQuery's $.post()
. First, I send开发者_Python百科 the post parameters to the application and it receives a 302 response. After that, when I send subsequent jQuery $.get()
requests to other pages, it is not posting the required cookies.
How can I resolve this?
Check this tute on using cookies with windows gadgets..
http://blogs.msdn.com/b/jaimer/archive/2006/09/28/making-rest-calls-and-using-session-state-from-a-sidebar-gadget_2e00_2e00_2e00_.aspx
Windows Desktop Gadgets don't automatically store cookies from XMLHttpRequests. You should be able to use getResponseHeader("Set-Cookie")
and then set them for future requests by specifying them in the headers
config for $.ajax
.
For more information, see the HTTP cookie (Wikipedia) and jQuery.ajax().
精彩评论