开发者

Lightwieght serializable and parse friendly datastructure for storing server control properties

I am using asp.net server controls and don't want to store the server contr开发者_StackOverflow社区ol properties in dreaded and hogging viewstate. So i need somekind of datastructure in c# to store those properties and serialize them into a client hidden state. Has someone done a study on which would give me the best Performance, remove redundant keys and which provides easy serialize/deserialize process also provide security from it being tampered. SessionState is not a good option for this, for people who want to go that way


You say you want to store the data in client hidden state. ViewState does exactly this: and I think Microsoft designed it to be compact. What makes you think you can do better?

IMHO there's no silver bullet, if you want to store the state client-side, stick to ViewState.


You can define a simple class, serialize the instance into a binary and do a Base64 encoding of that binary and use it in the hidden field. If you want to protect against tampering, I would suggest to include another hidden field containing a hash constructed out of the serialized data and a key which you can keep on the server side. You can then construct the same key again upon the form post and compare with the one you received in the hidden field.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜