本文发表在 rolia.net 枫下论坛>>> viewstate的好处很明显,坏处我抄了几段在下面。一个东西即有好处又有坏处,又不是必须要用的,就选择不用了。Web forms对初学者还能省点时间,有几年经验后就因该觉得web forms model既不能省时间,也没品质。
1) Being good or bad depends on what kind of application you are going to develop. The technical solution should be requirement-oriented. I don't think there is a universal criteria. There is no so-called good technology, but there is good solution. For tons of applications, Web Forms or ASP.NET can save significant efforts v.s. classic ASP.
Actually ViewStates (no matter what you call it) are the things you have to deal with when you are developing web app, either you take use of MS's or implement on your own. Personally I won't invent the wheels again or I have to admit I can't invent a better wheel than MS's.
>>> it adds few Kbytes to the page. This effects the loading of the page in the client.
放个dategrid,load 点数据,postback,然后看sourcecode,viewstate占了90-99%,也就是说viewstate把页面变大了10倍到100倍,关这个点够头痛了
2) Again, that depends on the requirements. Is it an Internet or Intranet app? Do clients have high speed access? How good is the server configuration? Should all conditions permit, the size of client HTML (containing viewstates) is not a problem.
A few KBs for most of today's environments are just NOTHING.
Moreover, it's supported to store the viewstates in server side storage, other than the client-side, as long as you have enough memory and processor capacity. That can significantly reduce the client-side page size and avoid the browser limitation.
>>> it is passed as plain text to the client. Anybody can tamper this value, because of this you shouldnt store any important data in the viewstate.
3) To avoid this, you can either a) override viewstates persistence process to encrypt the critical info or b) like above said, store the viewstates in server-side.
Finally, I would like to say it's always good to share some ideas, but not in a criticizing way.更多精彩文章及讨论,请光临枫下论坛 rolia.net
1) Being good or bad depends on what kind of application you are going to develop. The technical solution should be requirement-oriented. I don't think there is a universal criteria. There is no so-called good technology, but there is good solution. For tons of applications, Web Forms or ASP.NET can save significant efforts v.s. classic ASP.
Actually ViewStates (no matter what you call it) are the things you have to deal with when you are developing web app, either you take use of MS's or implement on your own. Personally I won't invent the wheels again or I have to admit I can't invent a better wheel than MS's.
>>> it adds few Kbytes to the page. This effects the loading of the page in the client.
放个dategrid,load 点数据,postback,然后看sourcecode,viewstate占了90-99%,也就是说viewstate把页面变大了10倍到100倍,关这个点够头痛了
2) Again, that depends on the requirements. Is it an Internet or Intranet app? Do clients have high speed access? How good is the server configuration? Should all conditions permit, the size of client HTML (containing viewstates) is not a problem.
A few KBs for most of today's environments are just NOTHING.
Moreover, it's supported to store the viewstates in server side storage, other than the client-side, as long as you have enough memory and processor capacity. That can significantly reduce the client-side page size and avoid the browser limitation.
>>> it is passed as plain text to the client. Anybody can tamper this value, because of this you shouldnt store any important data in the viewstate.
3) To avoid this, you can either a) override viewstates persistence process to encrypt the critical info or b) like above said, store the viewstates in server-side.
Finally, I would like to say it's always good to share some ideas, but not in a criticizing way.更多精彩文章及讨论,请光临枫下论坛 rolia.net