0

Is there any difference in using the following

Request.Cookies["Key"].Value

and

Request.Cookies["Key"].ToString()
शेखर
  • 17,412
  • 13
  • 61
  • 117

1 Answers1

1

Yes, running the following block of code demonstrates the different outputs:

Request.Cookies.Add(new HttpCookie("Test", "MyValue"));

Debug.Print(Request.Cookies["Test"].Value);
Debug.Print(Request.Cookies["Test"].ToString());

The first debug print will display "MyValue" whereas the second will display "System.Web.HttpCookie".

Damon
  • 3,004
  • 7
  • 24
  • 28