Session_Start infinite loop problem

M

Mehdi

Hi,


In order to keep all my properties and objects that I use in the session in
one place, I have created a class "SessionCore.cs" and on Session_Start I
create a new instance if it as follow:

Session["Core"] = new SessionCore(Session.SessionID);

The somewhere within the application for example when I need to get stored
CustomerID I use the following:

((CoreSession)Session["Core"]).CustomerID

which woks fine as long as in my Web.config I use mode="InProc"


However If I use mode="StateServer" Session_Start in Global.asax will into
infinite loop!


Does anyone know why and what the solution is please?


Thanks for your time in advance.


Kind Regards

Mehdi
 
B

bruce barker

when an object is stored in a non-inporc session manager, it must be
serialized. your default serialization logic must have a loop (say two
objects point to each other, or child to parent). you will have to write a
custom serializer to get around this.

-- bruce (sqlwork.com)


| Hi,
|
|
| In order to keep all my properties and objects that I use in the session
in
| one place, I have created a class "SessionCore.cs" and on Session_Start I
| create a new instance if it as follow:
|
| Session["Core"] = new SessionCore(Session.SessionID);
|
| The somewhere within the application for example when I need to get stored
| CustomerID I use the following:
|
| ((CoreSession)Session["Core"]).CustomerID
|
| which woks fine as long as in my Web.config I use mode="InProc"
|
|
| However If I use mode="StateServer" Session_Start in Global.asax will into
| infinite loop!
|
|
| Does anyone know why and what the solution is please?
|
|
| Thanks for your time in advance.
|
|
| Kind Regards
|
| Mehdi
|
|
 
M

Mehdi

Thanks Bruce,

I put [Serializable] on top of the SessionCore class and it worked.


Regards


Mehdi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top