Click here to Skip to main content
13,143,774 members (31,431 online)
Rate this:
Please Sign up or sign in to vote.
See more:

I have a object i stored this in a session["asp"]. when i am going to another page i want to call the same object there. i used the code like this

//storing the object in session
   Session["asp"] = objSer;
//in another page i am calling the session to store in new object and i have some thing to check there
 object objserials =Session["asp"];

i am unable to get the count of the session, means i have 5 values in it

and if objserials. (nothing is comming, some default values are coming.)

Posted 27-Dec-11 3:13am
Updated 27-Dec-11 3:17am
coded007 27-Dec-11 9:16am
edited "pre" tags
SAKryukov 27-Dec-11 11:20am
What is "call a session into object"? Like "Hey, session, come here, into this object, don't be afraid"? What is "call object"? You can only call a function/method/procedure, even a property (getter/setter), nothing else.
Even a delegate instance can be invoked, which is very different from a call.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You have to cast it to the appropriate type. So, if objSer was an int, you'd have to do this:
int value = (int)Session["asp"];

or, more appropriately:
int value;
Int32.TryParse(Session["asp"], out value);
inayat basha 27-Dec-11 9:19am
objSer is collection of types, mean to say it has so many records in it. like id,name,description
SAKryukov 27-Dec-11 11:20am
SAKryukov 27-Dec-11 11:20am
Yes, a 5.
You STILL have to cast it to the correct type before you can use it.
Espen Harlinn 30-Dec-11 9:33am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.170915.1 | Last Updated 27 Dec 2011
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100