Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 18th, 2007, 09:12 AM
Authorized User
 
Join Date: Jun 2006
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to jlrolin Send a message via MSN to jlrolin
Default SQL Session State & Object Array

I have an array of objects that I need to put into the session for postbacks to retain the values. I just got through switching to SQL Session State, and am unable to serialize the session state when added this array of objects to it.

What's the preferred way to do this? I have tried converting it to an ArrayList with no luck. Any suggestions?

________________________
ASP.NET 1.1 Developer
VB.NET Developer
__________________
________________________
ASP.NET 1.1/2.0 Developer
VB.NET Developer
 
Old June 19th, 2007, 03:09 AM
Authorized User
Points: 375, Level: 6
Points: 375, Level: 6 Points: 375, Level: 6 Points: 375, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2006
Location: New Delhi,India.
Posts: 79
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via AIM to anujrathi Send a message via MSN to anujrathi Send a message via Yahoo to anujrathi
Default

hi,
simply use Session["objectname"]=objvalue;
 
Old June 19th, 2007, 02:36 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

What type of objects are you trying to put into session? Most objects can be serialized for session state storage. I know that the HashTable can not be however.

-Peter
 
Old June 20th, 2007, 10:17 AM
Authorized User
 
Join Date: Jun 2006
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to jlrolin Send a message via MSN to jlrolin
Default

I tracked down the major problem here.

I am using SQLServer Session State. The classes are Serializable, BUT... the SoapHeaders are being returned in the objects from the web services. So when I add them to the Session, wham! I get hit with an error saying the SoapHeaders in the objects are not marked serializable.

Any suggestions?

Right now, I'm using the Cache, but it isn't as persistant as the Session.

________________________
ASP.NET 1.1 Developer
VB.NET Developer
 
Old June 20th, 2007, 12:49 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

I would disagree with you there. The session is only good for the length of the user's visit (plus the expiration timespan). You can cache a value for considerably longer.

I'm not sure I get your problem though. You are getting data from a web service and then putting the data in session? Why would you end up with soap headers after you get the object back from a web service call? Obviously, it's using soap to get the data from the web service, but after it's handed back by the service proxy it should be void of soap information. Are you using the standard service proxy or doing something custom?

-Peter




Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Session State with SQL Server Express 2005 toddw607 SQL Server 2005 1 December 18th, 2007 06:12 PM
SQL Server session state latency planoie ASP.NET 2.0 Professional 4 July 18th, 2007 09:47 AM
javascript intellisense & session object VictorVictor ASP.NET 2.0 Professional 0 March 29th, 2007 10:59 AM
Session State|View State|Do I have other options? rockon ASP.NET 1.x and 2.0 Application Design 2 October 5th, 2005 07:10 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.