Is it possible to create cookies with keys? Explain using some example.

 Posted by Bhakti on 11/17/2009 | Category: ASP.NET Interview questions | Views: 4297
Answer:

Yes , it is possible to create cookies with keys.
Cookies is a dictionary at the time of initialization, if key is specified with it. (You can determine whether cookie is dictionary or not using HasKeys property.)

For an example:
Response.Cookies("Testcookie")("key1") = "key1" 

Response.Cookies("Testcookie”)("key2") = "key2"


After this if you make assignment like,
Response.Cookies("Testcookie”) = “noKey”

Then,” key1” and “key2” of cookie("Testcookie”) will be deleted.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response