0

When i write HttpContext.Current.Response.Cookies in visual studio it says

Get the cookie with specified numerical index from the cookie collection

But when i use it to get cookie it sets if there is no cookie with name.

MSDN says

The Cookies collection sets the value of a cookie. If the specified cookie does not exist, it is created. If the cookie exists, it takes the new value, and the old value is discarded.

I know that request comes from browser and response goes form server. But still why does the immediate help says so?

Am i missing something ?

ScruffyDuck
  • 2,606
  • 3
  • 34
  • 50
Dinkar Thakur
  • 3,025
  • 5
  • 23
  • 35

1 Answers1

0

It's not a bug in Visual Studio.

The response cookie collection is not "write only", you can both write and read it.

Usually it's used to set cookies on the client, and the MSDN tells you about this, but nothing is preventing you from reading values back from it, and the text given by Visual Studio is telling you so when you try to access it by index.

Albireo
  • 10,977
  • 13
  • 62
  • 96