.net - adding Arraylist to cookies in asp.net/c# -


Can I add an array list to cookies? If so, how can I do this?

I tried to add it in this way:

Responses. Cookies ["User Information"] ["ComponentAralyst"] = ComponentAralyst;

But I'm getting the error:

Type 'system.click.orrelist' can not be changed on 'string' properly.

Please help me

> Thank you in anticipation

You do this ArrayList serial with DataContractJsonSerializer You can delete it, and later store it as JSON, you can delete it and recover the position of ArrayList. Also in the client-side code (javascript), for example $ .parseJSON with jQuery function.

By the way, this is a very bad idea that objects can be stored in cookies, because the size of the data size may vary, but to avoid having to store large sets of data,

You should consider using cookies to store identifiers and some limited user-specific client configurations, and other, the server code for more specific data Both should be used to query.

Comments