f# - How to set cookie? -
i have following code, uses http://fsharp.github.io/fsharp.data/library/http.html, login website , files. however, each page has piece of jquery script set cookie - $.cookie("authenticated", 14313432);. code has mimic jquery script set cc too. otherwise authentication fail. how using f# data: http utilities?
let cc = cookiecontainer() let h = http.requeststring(url, httpmethod = "get", cookiecontainer = cc, headers = headers) // embedded jquery set cookie let body = httprequestbody.formvalues ["username", "xxx"; "password", "ppp"] http.requeststring(url, body=body, httpmethod="post", cookiecontainer=cc, headers = ... let page = http.requeststring(....) // embedded jquery script set cookie different value let page2 = http.requeststring(....) // embedded jquery script set cookie different value
if right don't know how insert "authenticated", 14313432 cookie found how use cookiecontainer right?
well cookiecontainer .net class contiaining cookie objects, should trick:
let cc = cookiecontainer() let cookie = cookie ("authenticated", "14313432") cc.add cookie // rest of code
Comments
Post a Comment