473,410 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,410 software developers and data experts.

Using the Session object

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
13 1725
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
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
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
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
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
> 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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Abhilash.k.m | last post by:
This is regarding the session management using Out of proc session management(SQL SERVER). Among the samples below which one is better to set the session? 1. There are 20 session...
9
by: Greg Linwood | last post by:
I'm having difficulty understanding Session state in ASP.Net. It's almost embarrassing asking this as I've been using ASP since it was first released & it really shouldn't be this hard to use -...
4
by: Kevin Phifer | last post by:
Ok, before anyone freaks out, I have a solution I need to create that gathers content from maybe different places. Each one can return a <form> in the html, so its the classic can't have more than...
1
by: ratnakarp | last post by:
Hi, I have a search text box. The user enters the value in the text box and click on enter button. In code behind on button click i'm writing the code to get the values from the database and...
15
by: Joe Fallon | last post by:
I would like to know how you can figure out how much memory a given instance of a class is using. For example, if I load a collection class with 10 items it might use 1KB, and if I load it with...
9
by: viz | last post by:
hi, i have written a class for session handling, and i want to use it to keep track of the user. After authenticating the user in login page i am storing the session info like uname etc.. in a...
7
by: Rob | last post by:
Hi, I'm getting an error on my login page when using Javascript session object. It works on the development server so I'm wondering if there is a setting in IIS to allow using sessions on the...
0
by: Eugene Anthony | last post by:
The problem with my coding is that despite removing the records stored in the array list, the rptPages repeater control is still visible. The rptPages repeater control displayes the navigation...
0
by: srinivas srinivas | last post by:
Hi, I am developing simple peer-peer RTC application for monitoring the SDP packets and i need to set the TLS security for the transport. But iam struggling to achieving this. Iam using IP...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.