0

I am trying to make a GET request from my angular app something like $http.get("http://myurl.com/...");

the issue I am facing is on server side I am getting cookie as null. I need to get the cookies on server side and get logged in user's info.

What am I missing?

sweetcode
  • 159
  • 1
  • 12
  • 1
    You can't access the cookies of a different domain. Is it that your application is different from myurl.com and you're trying to get the cookies of myurl.com? – Sidharth Panwar Jul 02 '14 at 19:02

1 Answers1

0

First of all, I am assuming you are trying to set a cookie for your own domain to be accessed from the same domain. You can't access a cookie across domains.

To clarify the usage of cookies, you cannot "send" a cookie with a GET request to the server.

Instead, you need to make a cookie, either sent to the client from the server, or with client-side JavaScript.

After the cookie is set, then it will automatically be included with the request to the server.

Here is a link describing cookie functions and examples of how to set one with JavaScript (as you have tagged your question): http://www.codelib.net/javascript/cookies.html

Joseph Myers
  • 6,434
  • 27
  • 36