SharePoint Webpart中会话状态和视图状态的优缺点 [英] Pros and Cons of Session state and View state in SharePoint webpart

查看:72
本文介绍了SharePoint Webpart中会话状态和视图状态的优缺点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我们在SharePoint 2010中使用会话状态,是否有任何特定的危害或弊端?

实际上,在这种情况下,我们必须感知一个DataTable中的100行(每行七列),并在关闭SharePoint Modal对话框时进行的页面刷新调用期间感知其值.

实际上,我们必须通过打开Modal Popup而不将数据提交到数据库的方式,将行插入到父页面的datatable中.

如果不建议使用会话状态,是否将另存为100行的数据表存储在VIEWSTATE中将是一种替代解决方案?或者我们可以继续会话状态?

Is there any specific harm or drawback if we use Session state in SharePoint 2010 ?

Actually we have a scenario in which we have to perceive the 100 rows (with seven column in each row) in a DataTable and perceive its values during the page refresh call that is being made on close of the SharePoint Modal Dialog box .

Actually we have to insert the rows to the datatable of parent page by opening a Modal Popup without submitting the data to the database .

Does storing the datatable with 100 rows in VIEWSTATE will be an alternate solution ,if Session state is not recommended ? Or we can go ahead with Session state ?

推荐答案

默认情况下,SharePoint中的会话处于禁用状态.原因之一是内存使用率可能由成千上万的访问系统的用户调用.尽管可以启用它并将其设置为使用SQL Server,但在SharePoint中不推荐或不推荐使用它.

如果目标是保留数据,以便在关闭对话框后可以使用该数据,则可能还有其他选择. SharePoint 2010中的客户端对象模型允许异步操作刷新数据.关闭时,对话框框架也不会发出回发.

SharePoint 2010客户端对象模型,第1部分 [ ^ ]
Session is disabled by default in SharePoint. One reason is the memory usage may be invoked by thousands of users accessing the system. Although it can be enabled and set to use SQL Server, it isn''t a recommended or common practice with SharePoint.

If the goal is to persist the data so it is available after closing the dialog there may be other alternatives. The client object model in SharePoint 2010 allows for asynchronous operations to refresh the data. The dialog framework also does not issue a postback when closing that I''m aware of.

SharePoint 2010 Client Object Model, Part 1[^]


我一直在使用ViewState.

并且,只要数据的大小被合理地限制",它就可以很好地工作.对于给定的网络访问方案.

因此,问题是"HOW BIG?".持久化到ViewState隐藏字段时的数据是什么?如果这是太大",则返回否".是否主要取决于网络条件; ViewState的最终问题不是必须下载它,而是必须将其与每个请求一起发送回BACK-连接有时在性能上是不对称的.

只是要避免使用DataTable作为默认的序列化,它使用的默认序列化与ASP.NET中使用的序列化器(在不使用自定义序列化的原始结构树和集合中非常有效)结合使用时效果不佳.
I use ViewState all the time.

And it works good, PROVIDED that the SIZE of the data is "reasonably bounded" for the given network-access scenarios.

So the question is, "HOW BIG?" is the data when PERSISTED to the ViewState hidden field? If this is "too big" or not depends primarly upon network conditions; the ultimately issue with ViewState isn''t that it must be downloaded, but rather that it must be sent BACK with each request - and connections are sometimes asymmetric in performance.

Just avoid using a DataTable as the default Serialization it uses works poorly with the serializer used in ASP.NET (which is quite efficient for primitive structure trees and collections that don''t muck with a custom serialization).


这篇关于SharePoint Webpart中会话状态和视图状态的优缺点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆