TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
arjunan Selvam
NA
3
1.4k
cookies are not storing when calling from webapi
Jan 8 2014 9:03 PM
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 = "/";
cookieList.Add(ch);
}
ch = new CookieHeaderValue("ETag", resp.Headers.Get("ETag"));
ch.Path = "/";
cookieList.Add(ch);
}
result = sourceRequest.CreateResponse(resp.StatusCode);
result.Content = new StringContent(resultData, Encoding.UTF8, responseFormat);
result.Headers.AddCookies(cookieList);
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.
Reply
Answers (
1
)
How to connect my local database to hosed database in asp.ne
material for mvc