2

I have a Web API project and a separate web app. they have two different port numbers for their local host address. I am trying to set a cookie on the web app passed from the WEB API response. I can see it the cookie in the header, however the browser does not save the cookie. Also, if I set a cookie on the web app and try read it in the API request, it can not be seen.

 task.Result.Headers.AddCookies(new CookieHeaderValue[] {
                    new CookieHeaderValue(MemberToken, Guid.NewGuid().ToString()){
                        Domain = request.RequestUri.Host == "localhost" ? null : request.RequestUri.Host,
                        Expires = DateTime.Now.AddDays(30),
                        Path = "/"
                    }
                });
Mark Hollas
  • 1,107
  • 1
  • 16
  • 44

0 Answers0