Cookies are not storing when calling from webapi RRS feed

  • Question

  • i am calling one of the rest services using webapi.It will send the response as cookies.I want to reuse the cookies for further requests.I don't have any problem to use the cookies for subsequent calls.I tested everything in the restclient where i can see the cookies.but i tried to call the services using Jquery ajax and i noticed one thing like the cookies whatever i am sending in the response header is not getting stored in the browser.I tried in all the browser.I want to save cookies in the browser.I have shared the code what i am using below.

    CookieHeaderValue ch;
    List<CookieHeaderValue> cookieList = new List<CookieHeaderValue>();
    if (cookieStore != null)
    if (resp.Headers.Get("ETag") != null)
    foreach (Cookie ck in cookieStore.GetCookies(GetRequest.RequestUri))
    ch = new CookieHeaderValue(ck.Name, ck.Value);
    ch.Path = "/";
    ch = new CookieHeaderValue("ETag", resp.Headers.Get("ETag"));
    ch.Path = "/";
    result = sourceRequest.CreateResponse(resp.StatusCode);
    result.Content = new StringContent(resultData, Encoding.UTF8, responseFormat);

    I tried the same in google.most of them mentioned like it might be domain issue.I am not calling from the mylocal.I want to store cookies in the browser.
    Thursday, January 9, 2014 9:40 AM

All replies

  • Hi Arjunan,

    I think this thread is specific to ASP. NET forum. This form is to discuss problems about C# development. Please post a new thread on that forum for more effective response. http://forums.asp.net/.

    Thank you for your understanding.

    Best Regards,

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, January 10, 2014 5:33 AM