Ask a Question related to ASP.NET General, Design and Development.
-
VB Programmer #1
Question: Difference between strMyVar and Session("strMyVar")
If I have a variable I want to share in my application what is the
difference between just declaring a variable (Dim strMyVar as String) and
using a session variable (Session("strMyVar"))?
When should I use a session variable and when should I just declare it like
normal?
Thanks in advance!
VB Programmer Guest
-
What is the difference between a DNS "zone" and a DNS "domain"?
Gurus, What is the difference between a DNS "zone" and a DNS "domain"? I've been studying DNS a lot and grasp the concept, but I want to hear... -
Question about redirecting to a "session expired" page...
This may sound trivial but I cannot figure out how to do this... When a logged in user's session expires, I want that user redirected back to the... -
How can I "know" the difference between a session timed out and a session that did session.abort?
Any clues? Thanks for your time. Adam -
Which is faster? Dim dv As New DataView(session("myDataTable")) or CType(session("myDataTable"))
Hello, let's say my session("myDataTable") is type of DataTable Now what is faster? a) Dim dv As New DataView(session("myDataTable")) b) Dim... -
what's the difference between ". cmd" and "cmd" in shell script??
Thank u very much!! -- Zhao YouBing, Ph.D student State Key Lab of CAD&CG,Zhejiang University, Hangzhou, 310027, P.R.China Tel :... -
S. Justin Gengo #2
Re: Question: Difference between strMyVar and Session("strMyVar")
When a user signs on to your website a unique session id is created for
them. This session id is stored on their computer as a cookie. When you
place an object into a session variable that object remains in server memory
between trips to the client and may be "reclaimed" from one page to the
next.
When you declare a variable on a per page basis such as: Dim strMyVar as
String the object is only persisted in memory while the page is built and
then destroyed after the output is sent to the client.
You should use regular variables whenever an object does not need to persist
beyond a single request to the server. And use session variables when you
need to reference an object from one request to the server to another.
I hope this helps.
--
S. Justin Gengo, MCP
Web Developer
Free code library at:
[url]www.aboutfortunate.com[/url]
"Out of chaos comes order."
Nietzche
"VB Programmer" <growNO-SPAM@go-intech.com> wrote in message
news:ONLW3GpWDHA.2284@TK2MSFTNGP10.phx.gbl...like> If I have a variable I want to share in my application what is the
> difference between just declaring a variable (Dim strMyVar as String) and
> using a session variable (Session("strMyVar"))?
>
> When should I use a session variable and when should I just declare it> normal?
>
> Thanks in advance!
>
>
S. Justin Gengo Guest
-
VB Programmer #3
Re: Question: Difference between strMyVar and Session("strMyVar")
Thanks for the great response!
So would you use session variables where you needed a "global" variable?
"S. Justin Gengo" <sjgengo@aboutfortunate.com> wrote in message
news:%235WsRLpWDHA.1640@TK2MSFTNGP10.phx.gbl...memory> When a user signs on to your website a unique session id is created for
> them. This session id is stored on their computer as a cookie. When you
> place an object into a session variable that object remains in serverpersist> between trips to the client and may be "reclaimed" from one page to the
> next.
>
> When you declare a variable on a per page basis such as: Dim strMyVar as
> String the object is only persisted in memory while the page is built and
> then destroyed after the output is sent to the client.
>
> You should use regular variables whenever an object does not need toand> beyond a single request to the server. And use session variables when you
> need to reference an object from one request to the server to another.
>
> I hope this helps.
>
> --
> S. Justin Gengo, MCP
> Web Developer
>
> Free code library at:
> [url]www.aboutfortunate.com[/url]
>
> "Out of chaos comes order."
> Nietzche
> "VB Programmer" <growNO-SPAM@go-intech.com> wrote in message
> news:ONLW3GpWDHA.2284@TK2MSFTNGP10.phx.gbl...> > If I have a variable I want to share in my application what is the
> > difference between just declaring a variable (Dim strMyVar as String)> like> > using a session variable (Session("strMyVar"))?
> >
> > When should I use a session variable and when should I just declare it>> > normal?
> >
> > Thanks in advance!
> >
> >
>
VB Programmer Guest
-
VB Programmer #4
Re: Question: Difference between strMyVar and Session("strMyVar")
Thanks!
Is a cookie automatically created if I use session("xxx")? Or do I have to
enable something? (I do realize that the client has to have cookies enabled
on their end.)
"S. Justin Gengo" <sjgengo@aboutfortunate.com> wrote in message
news:eieMhXpWDHA.656@tk2msftngp13.phx.gbl...not> Exactly!
>
> There are also application variables. They are also global, but they are1> user specific. (i.e. If you set a session variable = 2 for one user and =each> for another, when each session variable is recalled on a server requestuser> user's session variable reflects their individual setting. An application
> level variable is the same for everyone. If user 1 sets it = 1 and thenwill> 2 sets it = 2 when user 1 makes a new request the application variablefor> be = 2.)
>
> --
> S. Justin Gengo, MCP
> Web Developer
>
> Free code library at:
> [url]www.aboutfortunate.com[/url]
>
> "Out of chaos comes order."
> Nietzche
> "VB Programmer" <growNO-SPAM@go-intech.com> wrote in message
> news:%230KOfSpWDHA.2352@TK2MSFTNGP12.phx.gbl...> > Thanks for the great response!
> >
> > So would you use session variables where you needed a "global" variable?
> >
> > "S. Justin Gengo" <sjgengo@aboutfortunate.com> wrote in message
> > news:%235WsRLpWDHA.1640@TK2MSFTNGP10.phx.gbl...> > > When a user signs on to your website a unique session id is createdyou> > > them. This session id is stored on their computer as a cookie. Whenthe> > memory> > > place an object into a session variable that object remains in server> > > between trips to the client and may be "reclaimed" from one page toas> > > next.
> > >
> > > When you declare a variable on a per page basis such as: Dim strMyVarString)> and> > > String the object is only persisted in memory while the page is built> you> > persist> > > then destroyed after the output is sent to the client.
> > >
> > > You should use regular variables whenever an object does not need to> > > beyond a single request to the server. And use session variables when> > > need to reference an object from one request to the server to another.
> > >
> > > I hope this helps.
> > >
> > > --
> > > S. Justin Gengo, MCP
> > > Web Developer
> > >
> > > Free code library at:
> > > [url]www.aboutfortunate.com[/url]
> > >
> > > "Out of chaos comes order."
> > > Nietzche
> > > "VB Programmer" <growNO-SPAM@go-intech.com> wrote in message
> > > news:ONLW3GpWDHA.2284@TK2MSFTNGP10.phx.gbl...
> > > > If I have a variable I want to share in my application what is the
> > > > difference between just declaring a variable (Dim strMyVar asit> > and> > > > using a session variable (Session("strMyVar"))?
> > > >
> > > > When should I use a session variable and when should I just declare>> >> > > like
> > > > normal?
> > > >
> > > > Thanks in advance!
> > > >
> > > >
> > >
> > >
> >
>
VB Programmer Guest
-
S. Justin Gengo #5
Re: Question: Difference between strMyVar and Session("strMyVar")
It's created automatically.
--
S. Justin Gengo, MCP
Web Developer
Free code library at:
[url]www.aboutfortunate.com[/url]
"Out of chaos comes order."
Nietzche
"VB Programmer" <growNO-SPAM@go-intech.com> wrote in message
news:e7naoopWDHA.1812@TK2MSFTNGP11.phx.gbl...to> Thanks!
>
> Is a cookie automatically created if I use session("xxx")? Or do I haveenabled> enable something? (I do realize that the client has to have cookies=> on their end.)
>
> "S. Justin Gengo" <sjgengo@aboutfortunate.com> wrote in message
> news:eieMhXpWDHA.656@tk2msftngp13.phx.gbl...> not> > Exactly!
> >
> > There are also application variables. They are also global, but they are> > user specific. (i.e. If you set a session variable = 2 for one user andapplication> 1> each> > for another, when each session variable is recalled on a server request> > user's session variable reflects their individual setting. Anvariable?> user> > level variable is the same for everyone. If user 1 sets it = 1 and then> will> > 2 sets it = 2 when user 1 makes a new request the application variable> > be = 2.)
> >
> > --
> > S. Justin Gengo, MCP
> > Web Developer
> >
> > Free code library at:
> > [url]www.aboutfortunate.com[/url]
> >
> > "Out of chaos comes order."
> > Nietzche
> > "VB Programmer" <growNO-SPAM@go-intech.com> wrote in message
> > news:%230KOfSpWDHA.2352@TK2MSFTNGP12.phx.gbl...> > > Thanks for the great response!
> > >
> > > So would you use session variables where you needed a "global"server> for> > >
> > > "S. Justin Gengo" <sjgengo@aboutfortunate.com> wrote in message
> > > news:%235WsRLpWDHA.1640@TK2MSFTNGP10.phx.gbl...
> > > > When a user signs on to your website a unique session id is created> you> > > > them. This session id is stored on their computer as a cookie. When> > > > place an object into a session variable that object remains instrMyVar> the> > > memory
> > > > between trips to the client and may be "reclaimed" from one page to> > > > next.
> > > >
> > > > When you declare a variable on a per page basis such as: Dimbuilt> as> > > > String the object is only persisted in memory while the page iswhen> > and> > > > then destroyed after the output is sent to the client.
> > > >
> > > > You should use regular variables whenever an object does not need to
> > > persist
> > > > beyond a single request to the server. And use session variablesanother.> > you> > > > need to reference an object from one request to the server todeclare> String)> > > >
> > > > I hope this helps.
> > > >
> > > > --
> > > > S. Justin Gengo, MCP
> > > > Web Developer
> > > >
> > > > Free code library at:
> > > > [url]www.aboutfortunate.com[/url]
> > > >
> > > > "Out of chaos comes order."
> > > > Nietzche
> > > > "VB Programmer" <growNO-SPAM@go-intech.com> wrote in message
> > > > news:ONLW3GpWDHA.2284@TK2MSFTNGP10.phx.gbl...
> > > > > If I have a variable I want to share in my application what is the
> > > > > difference between just declaring a variable (Dim strMyVar as> > > and
> > > > > using a session variable (Session("strMyVar"))?
> > > > >
> > > > > When should I use a session variable and when should I just> it>> >> > > > like
> > > > > normal?
> > > > >
> > > > > Thanks in advance!
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
>
S. Justin Gengo Guest



Reply With Quote

