开发者

SQL Session State & Javascript Error

开发者 https://www.devze.com 2023-02-06 03:48 出处:网络
I\'ve switch session storage to SQL server via: <sessionState mode=\"SQLServer\" sqlConnectionString=\"data source= jim; user id=jim;password=jim;\"

I've switch session storage to SQL server via:

    <sessionState mode="SQLServer"
           sqlConnectionString="data source= jim; user id=jim;password=jim;"
           cookieless="false"
           timeout="20" />

  </system.web>

and now I'm getting the following error in this code

var eventArgs = new Sys.WebForms.EndRequestEventArgs(error, data ? data.dataItems : {}, executor);
Sys.Observer.raiseEvent(this, "endRequest", eventArgs);
if (error && !eventArgs.get_errorHandled()) {
    throw error;
}

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500

If I leave session as the default rather than SQL Server it works fine. One further point, I can add items to the session OK - this seems to be occurring when the page is reloaded - maybe some kind of AJAX issue?

In terms of setting up SQL Session storage I did this: http://support.microsoft.com/kb/317604

The app works fine when I run it.

Thanks in advance.

Jim

EDIT - In the application log I can now see: 'System.Web.UI.WebControls.ListItem' in Assembly 'System.Web, Versi开发者_C百科on=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' is not marked as serializable.

... and true enough, I am adding a list item to the view state. But why does this work OK - except when storing session in SQL?]

Thanks again!

Jim


Well, when you need to externalize/serialize content, it needs to call serialize to get a stream. ListItem is a UI control that you should not have to serialize.. :) http://bytes.com/topic/asp-net/answers/322990-serializing-drop-down-list-data-sources-session-state

0

精彩评论

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