468,288 Members | 1,961 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,288 developers. It's quick & easy.

sessions, which is the more efficient way

Hi

I currently have a web site that utilises sessions on a particular page.
When a user clicks a button on this page, a session is created for the
duration of the request, and then terminated straight afterwards.

The user could do this a handful of times per visit, and although the site
does not have heavy traffic currently, it needs to be scalable to do so in
the future.

Now which way is more efficient.

1) To create a session when the user logs on, and use that same session for
this particular request how ever many time it's called. And time the session
out after 20 minutes.

2) Or to create and terminate the session for the duration of the request as
i am currently doing

Any help would be appreciated. Also, if i'm not clear enough in this
explanation, please let me know, and i will try explain in more detail.
Nov 19 '05 #1
4 931
"Grant Merwitz" <gr***@workshare.com> wrote in
news:ug**************@tk2msftngp13.phx.gbl:
Now which way is more efficient.

1) To create a session when the user logs on, and use that same
session for this particular request how ever many time it's called.
And time the session out after 20 minutes.

2) Or to create and terminate the session for the duration of the
request as i am currently doing


Option 2 defeats the purchase of session variables. Session variables are
used to store data that needs to persist for a session not a single
request. If you wish to only use a variable for a single request, use
context variables instead (httpcontext.current.items).

Another possiblity is to use Viewstate - these variables are valid for a
single page.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 19 '05 #2
I don't think i explained my problem properly hear.

I need to set this session to use another service on the same server. (which
is utilised during a single request on my aspx page)
This service requires this session to be set as a means of authentication.
Bear in mind, i have no control over this, i have to set a session.

So would it be better to set that session each time a user uses the method
that consumes this service

Or should i set the session for the duration of the Users visit

"Lucas Tam" <RE********@rogers.com> wrote in message
news:Xn***************************@127.0.0.1...
"Grant Merwitz" <gr***@workshare.com> wrote in
news:ug**************@tk2msftngp13.phx.gbl:
Now which way is more efficient.

1) To create a session when the user logs on, and use that same
session for this particular request how ever many time it's called.
And time the session out after 20 minutes.

2) Or to create and terminate the session for the duration of the
request as i am currently doing


Option 2 defeats the purchase of session variables. Session variables are
used to store data that needs to persist for a session not a single
request. If you wish to only use a variable for a single request, use
context variables instead (httpcontext.current.items).

Another possiblity is to use Viewstate - these variables are valid for a
single page.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/

Nov 19 '05 #3
"Grant Merwitz" <gr***@workshare.com> wrote in
news:eh**************@TK2MSFTNGP09.phx.gbl:
So would it be better to set that session each time a user uses the
method that consumes this service

Or should i set the session for the duration of the Users visit


I would just leave it set for the duration of the user's visit.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 19 '05 #4
Thanks.
"Lucas Tam" <RE********@rogers.com> wrote in message
news:Xn***************************@127.0.0.1...
"Grant Merwitz" <gr***@workshare.com> wrote in
news:eh**************@TK2MSFTNGP09.phx.gbl:
So would it be better to set that session each time a user uses the
method that consumes this service

Or should i set the session for the duration of the Users visit


I would just leave it set for the duration of the user's visit.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/

Nov 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by dmcconkey | last post: by
1 post views Thread by windandwaves | last post: by
3 posts views Thread by Will Woodhull | last post: by
reply views Thread by melledge | last post: by
3 posts views Thread by jantox | last post: by
2 posts views Thread by Coder | last post: by
3 posts views Thread by Jon Slaughter | last post: by
2 posts views Thread by MrBee | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.