Ankitt Gupta wrote:but the correct result is displayed after refreshing..On running for the first time it displays a blank
Cookies are a good way to remember data on the client for later, but are not a great way to transfer data to the client.
Remember, cookies are a
client-side mechanism. When you "create" a cookie on the response you are actually doing no such thing. You are creating a header on the response that tells the
browser to create the cookie when it gets the response.