Session_Start infinite loop problem

  • Thread starter Thread starter Mehdi
  • Start date Start date
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
 
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
|
|
 
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

Back
Top