By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,646 Members | 1,175 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,646 IT Pros & Developers. It's quick & easy.

Using the Session object

P: n/a
Simple question, I think...

I'm storing an object in the Session object.

In the code behind I read that object: trx = CType(Session("Transaction"), BOCSTransaction)

If I change any properties, I have to store it back into the session object to "update" it, right? Or will the changes to my object automatically be saved back into the session object?

Thanks,
Jerry
Jan 23 '06 #1
Share this Question
Share on Google+
13 Replies


P: n/a
Jerry,

You are right, you have to update session variables, there is no automatic link.

Eliyahu

<rl*****@newsgroups.nospam> wrote in message news:em*************@TK2MSFTNGP09.phx.gbl...
Simple question, I think...

I'm storing an object in the Session object.

In the code behind I read that object: trx = CType(Session("Transaction"), BOCSTransaction)

If I change any properties, I have to store it back into the session object to "update" it, right? Or will the changes to my object automatically be saved back into the session object?

Thanks,
Jerry
Jan 23 '06 #2

P: n/a
They are all references to the same space in the heap (memory). When you assign it to a new variable, you are only getting a handle on that space in memory.

So both your guesses are wrong. You don't have to store it back in the session, but that isn't because it's automatically "saved back into the session object".

Rather, the reason you don't have to save it back into the session is because there's ever only 1 instance of this object (unless you clone it) and thus updates made by any variable that point to that location will be reflected in all other variables that point there also.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
<rl*****@newsgroups.nospam> wrote in message news:em*************@TK2MSFTNGP09.phx.gbl...
Simple question, I think...

I'm storing an object in the Session object.

In the code behind I read that object: trx = CType(Session("Transaction"), BOCSTransaction)

If I change any properties, I have to store it back into the session object to "update" it, right? Or will the changes to my object automatically be saved back into the session object?

Thanks,
Jerry
Jan 23 '06 #3

P: n/a
one of us is fundamentally wrong...

loading up a test..

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message news:u9**************@tk2msftngp13.phx.gbl...
Jerry,

You are right, you have to update session variables, there is no automatic link.

Eliyahu

<rl*****@newsgroups.nospam> wrote in message news:em*************@TK2MSFTNGP09.phx.gbl...
Simple question, I think...

I'm storing an object in the Session object.

In the code behind I read that object: trx = CType(Session("Transaction"), BOCSTransaction)

If I change any properties, I have to store it back into the session object to "update" it, right? Or will the changes to my object automatically be saved back into the session object?

Thanks,
Jerry
Jan 23 '06 #4

P: n/a
Doesn't the concept of "references" form an automatic link. If he modifies the variable "trx", then that would also be reflected back in the session version, right? Unless the value stored in the session is a value type.

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message news:u9**************@tk2msftngp13.phx.gbl...
Jerry,

You are right, you have to update session variables, there is no automatic link.

Eliyahu

<rl*****@newsgroups.nospam> wrote in message news:em*************@TK2MSFTNGP09.phx.gbl...
Simple question, I think...

I'm storing an object in the Session object.

In the code behind I read that object: trx = CType(Session("Transaction"), BOCSTransaction)

If I change any properties, I have to store it back into the session object to "update" it, right? Or will the changes to my object automatically be saved back into the session object?

Thanks,
Jerry
Jan 23 '06 #5

P: n/a
That's what I said, and I just tried it out to make sure I wasn't bonkers.

I'm not familiar with BOCSTransaction so anything's possible, but I think Peter and I are right on this one.

Karl

"Peter Rilling" <pe***@nospam.rilling.net> wrote in message news:uL*************@TK2MSFTNGP15.phx.gbl...
Doesn't the concept of "references" form an automatic link. If he modifies the variable "trx", then that would also be reflected back in the session version, right? Unless the value stored in the session is a value type.

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message news:u9**************@tk2msftngp13.phx.gbl...
Jerry,

You are right, you have to update session variables, there is no automatic link.

Eliyahu

<rl*****@newsgroups.nospam> wrote in message news:em*************@TK2MSFTNGP09.phx.gbl...
Simple question, I think...

I'm storing an object in the Session object.

In the code behind I read that object: trx = CType(Session("Transaction"), BOCSTransaction)

If I change any properties, I have to store it back into the session object to "update" it, right? Or will the changes to my object automatically be saved back into the session object?

Thanks,
Jerry
Jan 23 '06 #6

P: n/a
> That's what I said, and I just tried it out to make sure I wasn't bonkers.

I'm not familiar with BOCSTransaction so anything's possible, but I think
Peter and I are right on this one.

Karl
If "BOCSTransaction" is an object, then this is true (just the
reference is stored in Session, so you are updating the "real" object).
However (just to be complete), if "BOCSTransaction" is a struct
(ValueType, sorry, don't know the VB name) then you will get a *copy*
of the stored struct. So then you *will* have to "store back" the
changed struct.

Hans Kesting


"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:uL*************@TK2MSFTNGP15.phx.gbl... Doesn't the concept of
"references" form an automatic link. If he modifies the variable "trx", then
that would also be reflected back in the session version, right? Unless the
value stored in the session is a value type.

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:u9**************@tk2msftngp13.phx.gbl... Jerry,

You are right, you have to update session variables, there is no
automatic link.

Eliyahu

<rl*****@newsgroups.nospam> wrote in message
news:em*************@TK2MSFTNGP09.phx.gbl... Simple question, I
think...

I'm storing an object in the Session object.

In the code behind I read that object: trx =
CType(Session("Transaction"), BOCSTransaction)

If I change any properties, I have to store it back into the session
object to "update" it, right? Or will the changes to my object automatically
be saved back into the session object?

Thanks,
Jerry

Jan 23 '06 #7

P: n/a
this is only true if the whats stored is session is an object. if its a value type (int, structure, etc), then you need to replace the session object.

also there are differences depending on the session manager. a inproc session manager hold a reference to the object until replaced or the session expires. an out-proc session manager (state, sqlserver), only references the object during the request, at request end, its serialized out. this means you can reference a session variable between requests (say a background thread) with a inproc session handler but not in out of proc hander. \

aslso if you store the same object twice in the session, if in proc they are the same object and stay the same, but in an out of proc session, they become seperate object on the next request.

-- bruce (sqlwork.com)

"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in message news:Ox**************@TK2MSFTNGP11.phx.gbl...
They are all references to the same space in the heap (memory). When you assign it to a new variable, you are only getting a handle on that space in memory.

So both your guesses are wrong. You don't have to store it back in the session, but that isn't because it's automatically "saved back into the session object".

Rather, the reason you don't have to save it back into the session is because there's ever only 1 instance of this object (unless you clone it) and thus updates made by any variable that point to that location will be reflected in all other variables that point there also.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
<rl*****@newsgroups.nospam> wrote in message news:em*************@TK2MSFTNGP09.phx.gbl...
Simple question, I think...

I'm storing an object in the Session object.

In the code behind I read that object: trx = CType(Session("Transaction"), BOCSTransaction)

If I change any properties, I have to store it back into the session object to "update" it, right? Or will the changes to my object automatically be saved back into the session object?

Thanks,
Jerry
Jan 23 '06 #8

P: n/a
Okay... Thanks everyone for their input.

This is my understanding...

BOCSTransaction is my own class, so it's an object stored, apparetly, by reference in the Session and I don't need to update the Session every time I change a property of it.

I'm still kinda new to the web architecture. I just wasn't sure if objects were serialized into some common space when you stored them in the Session. If it is truly just a heap pointer, then it's easy. Thanks.

Jerry

<rl*****@newsgroups.nospam> wrote in message news:em*************@TK2MSFTNGP09.phx.gbl...
Simple question, I think...

I'm storing an object in the Session object.

In the code behind I read that object: trx = CType(Session("Transaction"), BOCSTransaction)

If I change any properties, I have to store it back into the session object to "update" it, right? Or will the changes to my object automatically be saved back into the session object?

Thanks,
Jerry
Jan 23 '06 #9

P: n/a
Assume that we're using Inproc session, then all the variables held in
session state are in-memory objects. So whether we can directly modify the
object without reassign it back to the sessionstate entry depend on its
class type. If it's of reference type, the session state entry just hold
the reference to that object, so we can certainly just update it without
explicitly reassign. If a value type, reassign is necessary....

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| Subject: Re: =?UTF-8?B?VXNpbmcgdGhlIFNlc3Npb24gb2JqZWN0?=
| From: "Hans Kesting" <ne***********@spamgourmet.com>
| References: <em*************@TK2MSFTNGP09.phx.gbl>
<u9**************@tk2msftngp13.phx.gbl>
<uL*************@TK2MSFTNGP15.phx.gbl>
<uH**************@TK2MSFTNGP14.phx.gbl>
| Message-ID: <mn***********************@spamgourmet.com>
| X-Newsreader: MesNews/1.04.01.00-gb
| Date: Mon, 23 Jan 2006 18:03:03 +0100
| MIME-Version: 1.0
| Content-Type: text/plain; charset="utf-8"; format=flowed
| Content-Transfer-Encoding: 8bit
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: 127-24.bbned.dsl.internl.net 82.215.24.127
| Lines: 1
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP15.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:372924
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| > That's what I said, and I just tried it out to make sure I wasn't
bonkers.
| >
| > I'm not familiar with BOCSTransaction so anything's possible, but I
think
| > Peter and I are right on this one.
| >
| > Karl
|
| If "BOCSTransaction" is an object, then this is true (just the
| reference is stored in Session, so you are updating the "real" object).
| However (just to be complete), if "BOCSTransaction" is a struct
| (ValueType, sorry, don't know the VB name) then you will get a *copy*
| of the stored struct. So then you *will* have to "store back" the
| changed struct.
|
| Hans Kesting
|
|
| >
| > "Peter Rilling" <pe***@nospam.rilling.net> wrote in message
| > news:uL*************@TK2MSFTNGP15.phx.gbl... Doesn't the concept of
| > "references" form an automatic link. If he modifies the variable
"trx", then
| > that would also be reflected back in the session version, right?
Unless the
| > value stored in the session is a value type.
| >
| > "Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
| > news:u9**************@tk2msftngp13.phx.gbl... Jerry,
| >
| > You are right, you have to update session variables, there is no
| > automatic link.
| >
| > Eliyahu
| >
| > <rl*****@newsgroups.nospam> wrote in message
| > news:em*************@TK2MSFTNGP09.phx.gbl... Simple question, I
| > think...
| >
| > I'm storing an object in the Session object.
| >
| > In the code behind I read that object: trx =
| > CType(Session("Transaction"), BOCSTransaction)
| >
| > If I change any properties, I have to store it back into the
session
| > object to "update" it, right? Or will the changes to my object
automatically
| > be saved back into the session object?
| >
| > Thanks,
| > Jerry
|
|
|

Jan 24 '06 #10

P: n/a
Steven,

Do you mean that with outproc sessions you have to reassign always? If it is
true, isn't then reassigning is a good practice since you can switch between
different session managements without code changes?

Eliyahu
"Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
news:qM****************@TK2MSFTNGXA02.phx.gbl...
Assume that we're using Inproc session, then all the variables held in
session state are in-memory objects. So whether we can directly modify the
object without reassign it back to the sessionstate entry depend on its
class type. If it's of reference type, the session state entry just hold
the reference to that object, so we can certainly just update it without
explicitly reassign. If a value type, reassign is necessary....

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| Subject: Re: =?UTF-8?B?VXNpbmcgdGhlIFNlc3Npb24gb2JqZWN0?=
| From: "Hans Kesting" <ne***********@spamgourmet.com>
| References: <em*************@TK2MSFTNGP09.phx.gbl>
<u9**************@tk2msftngp13.phx.gbl>
<uL*************@TK2MSFTNGP15.phx.gbl>
<uH**************@TK2MSFTNGP14.phx.gbl>
| Message-ID: <mn***********************@spamgourmet.com>
| X-Newsreader: MesNews/1.04.01.00-gb
| Date: Mon, 23 Jan 2006 18:03:03 +0100
| MIME-Version: 1.0
| Content-Type: text/plain; charset="utf-8"; format=flowed
| Content-Transfer-Encoding: 8bit
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: 127-24.bbned.dsl.internl.net 82.215.24.127
| Lines: 1
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP15.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:372924
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| > That's what I said, and I just tried it out to make sure I wasn't
bonkers.
| >
| > I'm not familiar with BOCSTransaction so anything's possible, but I
think
| > Peter and I are right on this one.
| >
| > Karl
|
| If "BOCSTransaction" is an object, then this is true (just the
| reference is stored in Session, so you are updating the "real" object).
| However (just to be complete), if "BOCSTransaction" is a struct
| (ValueType, sorry, don't know the VB name) then you will get a *copy*
| of the stored struct. So then you *will* have to "store back" the
| changed struct.
|
| Hans Kesting
|
|
| >
| > "Peter Rilling" <pe***@nospam.rilling.net> wrote in message
| > news:uL*************@TK2MSFTNGP15.phx.gbl... Doesn't the concept of
| > "references" form an automatic link. If he modifies the variable
"trx", then
| > that would also be reflected back in the session version, right?
Unless the
| > value stored in the session is a value type.
| >
| > "Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
| > news:u9**************@tk2msftngp13.phx.gbl... Jerry,
| >
| > You are right, you have to update session variables, there is no
| > automatic link.
| >
| > Eliyahu
| >
| > <rl*****@newsgroups.nospam> wrote in message
| > news:em*************@TK2MSFTNGP09.phx.gbl... Simple question, I
| > think...
| >
| > I'm storing an object in the Session object.
| >
| > In the code behind I read that object: trx =
| > CType(Session("Transaction"), BOCSTransaction)
| >
| > If I change any properties, I have to store it back into the
session
| > object to "update" it, right? Or will the changes to my object
automatically
| > be saved back into the session object?
| >
| > Thanks,
| > Jerry
|
|
|

Jan 24 '06 #11

P: n/a
Of course not, Inproc session is the default and simplest scenario. For
out-proc session, first , class objects(not primitive types) which need to
be stored in session must be serializable, otherwise they can not be stored
in session. So that's another story an d I just use inproc session for
instance...

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "Eliyahu Goldin" <re*************@monarchmed.com>
| References: <em*************@TK2MSFTNGP09.phx.gbl>
<u9**************@tk2msftngp13.phx.gbl>
<uL*************@TK2MSFTNGP15.phx.gbl>
<uH**************@TK2MSFTNGP14.phx.gbl>
<mn***********************@spamgourmet.com>
<qM**************@TK2MSFTNGXA02.phx.gbl>
| Subject: Re: Using the Session object
| Date: Tue, 24 Jan 2006 09:55:17 +0200
| Lines: 108
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
| X-RFC2646: Format=Flowed; Original
| Message-ID: <u7**************@tk2msftngp13.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: 212.143.94.3
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msft ngp13.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:373054
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Steven,
|
| Do you mean that with outproc sessions you have to reassign always? If it
is
| true, isn't then reassigning is a good practice since you can switch
between
| different session managements without code changes?
|
| Eliyahu
|
|
| "Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
| news:qM****************@TK2MSFTNGXA02.phx.gbl...
| > Assume that we're using Inproc session, then all the variables held in
| > session state are in-memory objects. So whether we can directly modify
the
| > object without reassign it back to the sessionstate entry depend on its
| > class type. If it's of reference type, the session state entry just hold
| > the reference to that object, so we can certainly just update it without
| > explicitly reassign. If a value type, reassign is necessary....
| >
| > Regards,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| > --------------------
| > | Subject: Re: =?UTF-8?B?VXNpbmcgdGhlIFNlc3Npb24gb2JqZWN0?=
| > | From: "Hans Kesting" <ne***********@spamgourmet.com>
| > | References: <em*************@TK2MSFTNGP09.phx.gbl>
| > <u9**************@tk2msftngp13.phx.gbl>
| > <uL*************@TK2MSFTNGP15.phx.gbl>
| > <uH**************@TK2MSFTNGP14.phx.gbl>
| > | Message-ID: <mn***********************@spamgourmet.com>
| > | X-Newsreader: MesNews/1.04.01.00-gb
| > | Date: Mon, 23 Jan 2006 18:03:03 +0100
| > | MIME-Version: 1.0
| > | Content-Type: text/plain; charset="utf-8"; format=flowed
| > | Content-Transfer-Encoding: 8bit
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | NNTP-Posting-Host: 127-24.bbned.dsl.internl.net 82.215.24.127
| > | Lines: 1
| > | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP15.phx.gbl
| > | Xref: TK2MSFTNGXA02.phx.gbl
| > microsoft.public.dotnet.framework.aspnet:372924
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > |
| > | > That's what I said, and I just tried it out to make sure I wasn't
| > bonkers.
| > | >
| > | > I'm not familiar with BOCSTransaction so anything's possible, but I
| > think
| > | > Peter and I are right on this one.
| > | >
| > | > Karl
| > |
| > | If "BOCSTransaction" is an object, then this is true (just the
| > | reference is stored in Session, so you are updating the "real"
object).
| > | However (just to be complete), if "BOCSTransaction" is a struct
| > | (ValueType, sorry, don't know the VB name) then you will get a *copy*
| > | of the stored struct. So then you *will* have to "store back" the
| > | changed struct.
| > |
| > | Hans Kesting
| > |
| > |
| > | >
| > | > "Peter Rilling" <pe***@nospam.rilling.net> wrote in message
| > | > news:uL*************@TK2MSFTNGP15.phx.gbl... Doesn't the concept
of
| > | > "references" form an automatic link. If he modifies the variable
| > "trx", then
| > | > that would also be reflected back in the session version, right?
| > Unless the
| > | > value stored in the session is a value type.
| > | >
| > | > "Eliyahu Goldin" <re*************@monarchmed.com> wrote in
message
| > | > news:u9**************@tk2msftngp13.phx.gbl... Jerry,
| > | >
| > | > You are right, you have to update session variables, there is no
| > | > automatic link.
| > | >
| > | > Eliyahu
| > | >
| > | > <rl*****@newsgroups.nospam> wrote in message
| > | > news:em*************@TK2MSFTNGP09.phx.gbl... Simple question,
I
| > | > think...
| > | >
| > | > I'm storing an object in the Session object.
| > | >
| > | > In the code behind I read that object: trx =
| > | > CType(Session("Transaction"), BOCSTransaction)
| > | >
| > | > If I change any properties, I have to store it back into the
| > session
| > | > object to "update" it, right? Or will the changes to my object
| > automatically
| > | > be saved back into the session object?
| > | >
| > | > Thanks,
| > | > Jerry
| > |
| > |
| > |
| >
|
|
|

Jan 24 '06 #12

P: n/a
As you said, the requirement of being serializable is another story, I know
about it. I am asking on reassigning. Do outproc session managers work as
Bruce describes in another post to this thread, that session variables get
serialized out at the end of request, and, therefore, you don't need to
reassign?

Eliyahu

"Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
news:gi**************@TK2MSFTNGXA02.phx.gbl...
Of course not, Inproc session is the default and simplest scenario. For
out-proc session, first , class objects(not primitive types) which need to
be stored in session must be serializable, otherwise they can not be
stored
in session. So that's another story an d I just use inproc session for
instance...

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "Eliyahu Goldin" <re*************@monarchmed.com>
| References: <em*************@TK2MSFTNGP09.phx.gbl>
<u9**************@tk2msftngp13.phx.gbl>
<uL*************@TK2MSFTNGP15.phx.gbl>
<uH**************@TK2MSFTNGP14.phx.gbl>
<mn***********************@spamgourmet.com>
<qM**************@TK2MSFTNGXA02.phx.gbl>
| Subject: Re: Using the Session object
| Date: Tue, 24 Jan 2006 09:55:17 +0200
| Lines: 108
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
| X-RFC2646: Format=Flowed; Original
| Message-ID: <u7**************@tk2msftngp13.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: 212.143.94.3
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msft ngp13.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:373054
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Steven,
|
| Do you mean that with outproc sessions you have to reassign always? If
it
is
| true, isn't then reassigning is a good practice since you can switch
between
| different session managements without code changes?
|
| Eliyahu
|
|
| "Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
| news:qM****************@TK2MSFTNGXA02.phx.gbl...
| > Assume that we're using Inproc session, then all the variables held in
| > session state are in-memory objects. So whether we can directly modify
the
| > object without reassign it back to the sessionstate entry depend on
its
| > class type. If it's of reference type, the session state entry just
hold
| > the reference to that object, so we can certainly just update it
without
| > explicitly reassign. If a value type, reassign is necessary....
| >
| > Regards,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| > --------------------
| > | Subject: Re: =?UTF-8?B?VXNpbmcgdGhlIFNlc3Npb24gb2JqZWN0?=
| > | From: "Hans Kesting" <ne***********@spamgourmet.com>
| > | References: <em*************@TK2MSFTNGP09.phx.gbl>
| > <u9**************@tk2msftngp13.phx.gbl>
| > <uL*************@TK2MSFTNGP15.phx.gbl>
| > <uH**************@TK2MSFTNGP14.phx.gbl>
| > | Message-ID: <mn***********************@spamgourmet.com>
| > | X-Newsreader: MesNews/1.04.01.00-gb
| > | Date: Mon, 23 Jan 2006 18:03:03 +0100
| > | MIME-Version: 1.0
| > | Content-Type: text/plain; charset="utf-8"; format=flowed
| > | Content-Transfer-Encoding: 8bit
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | NNTP-Posting-Host: 127-24.bbned.dsl.internl.net 82.215.24.127
| > | Lines: 1
| > | Path:
TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP15.phx.gbl
| > | Xref: TK2MSFTNGXA02.phx.gbl
| > microsoft.public.dotnet.framework.aspnet:372924
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > |
| > | > That's what I said, and I just tried it out to make sure I wasn't
| > bonkers.
| > | >
| > | > I'm not familiar with BOCSTransaction so anything's possible, but
I
| > think
| > | > Peter and I are right on this one.
| > | >
| > | > Karl
| > |
| > | If "BOCSTransaction" is an object, then this is true (just the
| > | reference is stored in Session, so you are updating the "real"
object).
| > | However (just to be complete), if "BOCSTransaction" is a struct
| > | (ValueType, sorry, don't know the VB name) then you will get a
*copy*
| > | of the stored struct. So then you *will* have to "store back" the
| > | changed struct.
| > |
| > | Hans Kesting
| > |
| > |
| > | >
| > | > "Peter Rilling" <pe***@nospam.rilling.net> wrote in message
| > | > news:uL*************@TK2MSFTNGP15.phx.gbl... Doesn't the concept
of
| > | > "references" form an automatic link. If he modifies the variable
| > "trx", then
| > | > that would also be reflected back in the session version, right?
| > Unless the
| > | > value stored in the session is a value type.
| > | >
| > | > "Eliyahu Goldin" <re*************@monarchmed.com> wrote in
message
| > | > news:u9**************@tk2msftngp13.phx.gbl... Jerry,
| > | >
| > | > You are right, you have to update session variables, there is
no
| > | > automatic link.
| > | >
| > | > Eliyahu
| > | >
| > | > <rl*****@newsgroups.nospam> wrote in message
| > | > news:em*************@TK2MSFTNGP09.phx.gbl... Simple
question,
I
| > | > think...
| > | >
| > | > I'm storing an object in the Session object.
| > | >
| > | > In the code behind I read that object: trx =
| > | > CType(Session("Transaction"), BOCSTransaction)
| > | >
| > | > If I change any properties, I have to store it back into the
| > session
| > | > object to "update" it, right? Or will the changes to my object
| > automatically
| > | > be saved back into the session object?
| > | >
| > | > Thanks,
| > | > Jerry
| > |
| > |
| > |
| >
|
|
|

Jan 24 '06 #13

P: n/a
Yes, as for reassigning, it's the same with inproc session.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "Eliyahu Goldin" <re*************@monarchmed.com>
| References: <em*************@TK2MSFTNGP09.phx.gbl>
<u9**************@tk2msftngp13.phx.gbl>
<uL*************@TK2MSFTNGP15.phx.gbl>
<uH**************@TK2MSFTNGP14.phx.gbl>
<mn***********************@spamgourmet.com>
<qM**************@TK2MSFTNGXA02.phx.gbl>
<u7**************@tk2msftngp13.phx.gbl>
<gi**************@TK2MSFTNGXA02.phx.gbl>
| Subject: Re: Using the Session object
| Date: Tue, 24 Jan 2006 12:31:22 +0200
| Lines: 177
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
| X-RFC2646: Format=Flowed; Original
| Message-ID: <eo*************@TK2MSFTNGP11.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: 212.143.94.3
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP11.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:373082
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| As you said, the requirement of being serializable is another story, I
know
| about it. I am asking on reassigning. Do outproc session managers work as
| Bruce describes in another post to this thread, that session variables
get
| serialized out at the end of request, and, therefore, you don't need to
| reassign?
|
| Eliyahu
|
| "Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
| news:gi**************@TK2MSFTNGXA02.phx.gbl...
| > Of course not, Inproc session is the default and simplest scenario. For
| > out-proc session, first , class objects(not primitive types) which need
to
| > be stored in session must be serializable, otherwise they can not be
| > stored
| > in session. So that's another story an d I just use inproc session for
| > instance...
| >
| > Regards,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| > --------------------
| > | From: "Eliyahu Goldin" <re*************@monarchmed.com>
| > | References: <em*************@TK2MSFTNGP09.phx.gbl>
| > <u9**************@tk2msftngp13.phx.gbl>
| > <uL*************@TK2MSFTNGP15.phx.gbl>
| > <uH**************@TK2MSFTNGP14.phx.gbl>
| > <mn***********************@spamgourmet.com>
| > <qM**************@TK2MSFTNGXA02.phx.gbl>
| > | Subject: Re: Using the Session object
| > | Date: Tue, 24 Jan 2006 09:55:17 +0200
| > | Lines: 108
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
| > | X-RFC2646: Format=Flowed; Original
| > | Message-ID: <u7**************@tk2msftngp13.phx.gbl>
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | NNTP-Posting-Host: 212.143.94.3
| > | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msft ngp13.phx.gbl
| > | Xref: TK2MSFTNGXA02.phx.gbl
| > microsoft.public.dotnet.framework.aspnet:373054
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > |
| > | Steven,
| > |
| > | Do you mean that with outproc sessions you have to reassign always?
If
| > it
| > is
| > | true, isn't then reassigning is a good practice since you can switch
| > between
| > | different session managements without code changes?
| > |
| > | Eliyahu
| > |
| > |
| > | "Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
| > | news:qM****************@TK2MSFTNGXA02.phx.gbl...
| > | > Assume that we're using Inproc session, then all the variables held
in
| > | > session state are in-memory objects. So whether we can directly
modify
| > the
| > | > object without reassign it back to the sessionstate entry depend on
| > its
| > | > class type. If it's of reference type, the session state entry just
| > hold
| > | > the reference to that object, so we can certainly just update it
| > without
| > | > explicitly reassign. If a value type, reassign is necessary....
| > | >
| > | > Regards,
| > | >
| > | > Steven Cheng
| > | > Microsoft Online Support
| > | >
| > | > Get Secure! www.microsoft.com/security
| > | > (This posting is provided "AS IS", with no warranties, and confers
no
| > | > rights.)
| > | >
| > | >
| > | > --------------------
| > | > | Subject: Re: =?UTF-8?B?VXNpbmcgdGhlIFNlc3Npb24gb2JqZWN0?=
| > | > | From: "Hans Kesting" <ne***********@spamgourmet.com>
| > | > | References: <em*************@TK2MSFTNGP09.phx.gbl>
| > | > <u9**************@tk2msftngp13.phx.gbl>
| > | > <uL*************@TK2MSFTNGP15.phx.gbl>
| > | > <uH**************@TK2MSFTNGP14.phx.gbl>
| > | > | Message-ID: <mn***********************@spamgourmet.com>
| > | > | X-Newsreader: MesNews/1.04.01.00-gb
| > | > | Date: Mon, 23 Jan 2006 18:03:03 +0100
| > | > | MIME-Version: 1.0
| > | > | Content-Type: text/plain; charset="utf-8"; format=flowed
| > | > | Content-Transfer-Encoding: 8bit
| > | > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | > | NNTP-Posting-Host: 127-24.bbned.dsl.internl.net 82.215.24.127
| > | > | Lines: 1
| > | > | Path:
| > TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP15.phx.gbl
| > | > | Xref: TK2MSFTNGXA02.phx.gbl
| > | > microsoft.public.dotnet.framework.aspnet:372924
| > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > | > |
| > | > | > That's what I said, and I just tried it out to make sure I
wasn't
| > | > bonkers.
| > | > | >
| > | > | > I'm not familiar with BOCSTransaction so anything's possible,
but
| > I
| > | > think
| > | > | > Peter and I are right on this one.
| > | > | >
| > | > | > Karl
| > | > |
| > | > | If "BOCSTransaction" is an object, then this is true (just the
| > | > | reference is stored in Session, so you are updating the "real"
| > object).
| > | > | However (just to be complete), if "BOCSTransaction" is a struct
| > | > | (ValueType, sorry, don't know the VB name) then you will get a
| > *copy*
| > | > | of the stored struct. So then you *will* have to "store back" the
| > | > | changed struct.
| > | > |
| > | > | Hans Kesting
| > | > |
| > | > |
| > | > | >
| > | > | > "Peter Rilling" <pe***@nospam.rilling.net> wrote in message
| > | > | > news:uL*************@TK2MSFTNGP15.phx.gbl... Doesn't the
concept
| > of
| > | > | > "references" form an automatic link. If he modifies the
variable
| > | > "trx", then
| > | > | > that would also be reflected back in the session version, right?
| > | > Unless the
| > | > | > value stored in the session is a value type.
| > | > | >
| > | > | > "Eliyahu Goldin" <re*************@monarchmed.com> wrote in
| > message
| > | > | > news:u9**************@tk2msftngp13.phx.gbl... Jerry,
| > | > | >
| > | > | > You are right, you have to update session variables, there
is
| > no
| > | > | > automatic link.
| > | > | >
| > | > | > Eliyahu
| > | > | >
| > | > | > <rl*****@newsgroups.nospam> wrote in message
| > | > | > news:em*************@TK2MSFTNGP09.phx.gbl... Simple
| > question,
| > I
| > | > | > think...
| > | > | >
| > | > | > I'm storing an object in the Session object.
| > | > | >
| > | > | > In the code behind I read that object: trx =
| > | > | > CType(Session("Transaction"), BOCSTransaction)
| > | > | >
| > | > | > If I change any properties, I have to store it back into
the
| > | > session
| > | > | > object to "update" it, right? Or will the changes to my object
| > | > automatically
| > | > | > be saved back into the session object?
| > | > | >
| > | > | > Thanks,
| > | > | > Jerry
| > | > |
| > | > |
| > | > |
| > | >
| > |
| > |
| > |
| >
|
|
|

Jan 24 '06 #14

This discussion thread is closed

Replies have been disabled for this discussion.