Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C# ASP.NET
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 4:13am
Edited 27-Dec-11 4:17am
coded007 at 27-Dec-11 9:16am
edited "pre" tags
SAKryukov at 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 at 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 at 27-Dec-11 11:20am
John Simmons / outlaw programmer at 27-Dec-11 11:24am
You STILL have to cast it to the correct type before you can use it.
SAKryukov at 27-Dec-11 11:20am
Yes, a 5.
Espen Harlinn at 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
0 OriginalGriff 410
1 Sergey Alexandrovich Kryukov 350
2 ProgramFOX 275
3 Maciej Los 275
4 CHill60 260
0 OriginalGriff 360
1 ProgramFOX 265
2 Maciej Los 235
3 CHill60 200
4 RyanDev 170

Advertise | Privacy | Mobile
Web01 | 2.8.150331.1 | Last Updated 27 Dec 2011
Copyright © CodeProject, 1999-2015
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