2009-11-25 33 views
0

好吧,我是新來的SharePoint和ASP,所以忍受着我...無效的SharePoint會話對象

我想堅持對象到session數組來維持回傳之間的東西。我在我的web.config文件中啓用了會話數組,並且如果使用屬於.NET框架的基本值類型或對象,則一切正常。

但是,如果我嘗試保存一個我定義該類的對象的實例,則會收到錯誤消息「發生了意外錯誤」,儘管我可以在不引發任何錯誤的情況下逐步執行該程序。

我需要做些什麼才能將我的對象保存到會話數組中?


編輯:

於是開始調用堆棧的建議後,我收到以下錯誤:

Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in 'Custom' mode.

我想我可以序列我的對象...有一個設置在配置文件,使其不需要SQL Server?

+0

獲取有關您的錯誤的更多信息: http://www.planettutorials.com/Blog/tabid/59 /ID/13/How-to-show-detailed-Error-and-Stack-Trace-in-SharePoint.aspx – 2009-11-26 00:14:08

回答

2

馬克與[可序列化]自定義類屬性。如果您的課程有其他自定義類別的引用字段,請確保它們具有[Serializeable]屬性以及

0

是否在web.config中啓用SharePoint會話HttpModule?

<add name="Session" type="System.Web.SessionState.SessionStateModule"/>

,如果你在你的web.config文件中設置調用堆棧=「真」,你也許可以看到「[錯誤原因]因爲會話狀態已禁用」