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

Testing ASP application sessions

P: n/a
Hello, I have a couple of unclear questions about ASP.NET sessions:

First, I'd like to have some way to see how many sessions currently are
running on the certain application, and, possibly, have some way to peek in
the data of these sessions. If there is no such utility for IIS, perhaps
there is some API that I could use to write a standalone console .NET EXE,
that could talk to IIS (or some other relevant instance) and discover these
data?

Second, I'd like to know, if there is some way to distinguish from different
session expirations. I have a Session_End handler in the codebehind file for
global.asax, and, as by design, it is called whenever the session is about
to be finished, be it call to Session.Abandon, or just automatic session
expiration. So, I'd like to know if there is some way to tell from the
different reasons why session is being ended:
- is it a call to Abandon() method,
- is it an automatic expiration (ie user just closed the application, not
clicked 'log out' button)
- manual application stop
- perhaps code in the bin folder (or web.config file) has changed, forcing
application reload
- any other reason.

Currently I handle the difference by assigning a control value to session
variable prior to calling the Abandon method, and checking for the presence
of this variable in Session_End handler. But, it's sort of hacky way, isn't
it. Also, I see no such workaround way to check for application restart or
code changing situation.

Regards,

Pavils
Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
The number of sessions is exposed through performance counters.

By nature session variables are scoped to the parent session. You can't do
that from your app and I don't know if a tool is provided for doing this
(you can if using SQL Server as the session provider). Why do you want to
do that ? You could dump session variables when an error is encoutered.

A sesion doesn't expires when the browser is closed (it expired once the
server has no news from the suer druing a given period of time).

Once again it depends what is the overall goal (for example you can track
application restarts through .NET classes).

Patrice

--

"Pavils Jurjans" <pa****@mailbox.riga.lv> a écrit dans le message de
news:Oo**************@TK2MSFTNGP12.phx.gbl...
Hello, I have a couple of unclear questions about ASP.NET sessions:

First, I'd like to have some way to see how many sessions currently are
running on the certain application, and, possibly, have some way to peek in the data of these sessions. If there is no such utility for IIS, perhaps
there is some API that I could use to write a standalone console .NET EXE,
that could talk to IIS (or some other relevant instance) and discover these data?

Second, I'd like to know, if there is some way to distinguish from different session expirations. I have a Session_End handler in the codebehind file for global.asax, and, as by design, it is called whenever the session is about
to be finished, be it call to Session.Abandon, or just automatic session
expiration. So, I'd like to know if there is some way to tell from the
different reasons why session is being ended:
- is it a call to Abandon() method,
- is it an automatic expiration (ie user just closed the application, not
clicked 'log out' button)
- manual application stop
- perhaps code in the bin folder (or web.config file) has changed, forcing
application reload
- any other reason.

Currently I handle the difference by assigning a control value to session
variable prior to calling the Abandon method, and checking for the presence of this variable in Session_End handler. But, it's sort of hacky way, isn't it. Also, I see no such workaround way to check for application restart or
code changing situation.

Regards,

Pavils

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.