शेखर
शेखर

Reputation: 17614

Difference between Request.Cookies["Key"].Value and Request.Cookies["Key"].ToString()

Is there any difference in using the following

Request.Cookies["Key"].Value

and

Request.Cookies["Key"].ToString()

Upvotes: 0

Views: 518

Answers (1)

Damon
Damon

Reputation: 3012

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".

Upvotes: 1

Related Questions