NJ  Bhanushali

NJ Bhanushali

  • NA
  • 13
  • 15.7k

how to set(pass) cookie value in postrequest

Feb 6 2016 7:15 AM

I am developing windows store app. in this I am facing issue of cookie

I want to fetch cookie value from response of HttpClient request and pass that cookie in every request

In some PC ,cookie value generated correctly as shown in image.and in some PC ,cookie value not generated correctly.

I am getting cookies value "frontend=3fp614nm52nm0le5is0nef0tg0; expires=Sat, 06-Feb-2016 13:24:54 GMT; path=/extensioncheck1800test; domain=e.indiaondesk.com; HttpOnly" in both the case

I am adding cookie in cookiecontainer like

handler.CookieContainer.Add(baseAddress, new System.Net.Cookie("Set-Cookie", cooky));

Here Cookie value generated correctly with correct format and pass properly

But in some PC

I am trying to fetch cookie value by GetCookies - it's not generated properly

I am using cookie = handler.CookieContainer.GetCookies(baseAddress); but,its not working properly.

Can anyone please help to resolve this issue ?


Answers (2)