Android Question Insert a cookie using HTTPJob.GetRequest.SetHeader

lentunti

Member
Licensed User
Longtime User
Hi all,

Is it possible to use HTTPJob.GetRequest.SetHeader to replicate a cookie like this one in CookieManager:-

CookieManager1.SetCookie("https://devtablet.nwhub.co.uk/api/jobs/fetchJobs", "NWTABLETGATEWAYSESSION=lg9f3d66b04k77dfusek9bmfl5")

I have to apply to to a HttpJob.download2 as opposed to a WebView.

Is this possible?

I have tried
HTTPJob.GetRequest.SetHeader("SET-COOKIE", "NWTABLETGATEWAYSESSION=lg9f3d66b04k77dfusek9bmfl5; path=https://devtablet.nwhub.co.uk/api/jobs/fetchJobs")
but it doesn't seem to work

Thanks for any help.

regards
Lee
 

lentunti

Member
Licensed User
Longtime User
You need to set "Cookie" not "Set-Cookie". Set-Cookie header is used by the server (in the response) to ask the browser to set the cookies.

This is now my code :-
getJobs.download2("https://devtablet.nwhub.co.uk/api/jobs/fetchJobs", Array As String ("action", JSONstring))
getJobs.GetRequest.SetHeader("Cookie", "NWTABLETGATEWAYSESSION=lg9f3d66b04k77dfusek9bmfl5; path=https://devtablet.nwhub.co.uk/api/jobs/fetchJobs")

Which now gives me an internal server error. Your you say that thus suggests that the cookie has worked but there is a problem on the server (Possible dumb question).

thanks for your help.

Lee
 
Upvote 0
Top