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

sessions, which is the more efficient way

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
"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

P: n/a
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

P: n/a
"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

P: n/a
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.