No real error handling...but I've even gone so far as to put a
Session.Abandon() call in my code-behind file...and it STILL does not end.
Here're the particulars:
From my home.aspx.cs file:
private void Page_Load(object sender, System.EventArgs e)
{
orgLog myLog = (orgLog)Application["orgLog"];
myLog.WriteLine( "Testing" );
Session.Abandon();
}
From my global.asax.cs file:
protected void Session_Start(Object sender, EventArgs e)
{
orgLog LogFile;
Application.Lock();
LogFile = (orgLog)Application["orgLog"];
Application.UnLock();
Session["IPADDR"] = "19.19.19.19"; // just used to store something in the
session
LogFile.WriteLine( ":: Session Begins for " +
Request.ServerVariables["REMOTE_ADDR"].ToString() );
}
protected void Session_End(Object sender, EventArgs e)
{
orgLog LogFile;
Application.Lock();
LogFile = (orgLog)Application["orgLog"];
Application.UnLock();
LogFile.WriteLine( ":: Session Ends for " +
Request.ServerVariables["REMOTE_ADDR"].ToString() );
}
// orgLog is a home made information logging tool (it creates a log file).
I'd think that maybe the problem is here, but I can log to it over and over
without difficulty..
From the Log File:
[7/9/2003 4:10:37 PM] == Application Starts ==
[7/9/2003 4:10:38 PM] :: Session Begins for 127.0.0.1
[7/9/2003 4:10:38 PM] Testing
[7/9/2003 4:25:25 PM] == Application Starts ==
[7/9/2003 4:25:25 PM] :: Session Begins for 127.0.0.1
[7/9/2003 4:25:25 PM] Testing
[7/9/2003 4:30:27 PM] :: Session Begins for 127.0.0.1
[7/9/2003 4:30:27 PM] Testing
[7/9/2003 4:30:28 PM] :: Session Begins for 127.0.0.1
[7/9/2003 4:30:28 PM] Testing
Notice that I'm getting a new Session for each iteration (I'm not sure why)
but I'm never getting a Session_End...
If anyone notices anything out of place, please let me know. I've got my
session timeout set to 1, so I should be getting the session_end after a
minute...but I just seem to be getting a new session without the old session
ever ending...
Kevin Spencer said:
What sort of error-handling are you implementing for this? It sounds
like
an
error may be aborting the process somewhere.
HTH,
Kevin Spencer
Microsoft FrontPage MVP
Internet Developer
http://www.takempis.com
Some things just happen.
Everything else occurs.
to
a
file -- and an accompanying Application_Start() routine to read it in so
that when the application starts again, I can start counting where I left
off -- but never seems to fire either. The counter file is always set to
0).
How do you know for sure that it NEVER fires? The Session_End Event
happens
usually some time after the user has closed their browser or navigated
elsewhere. As the server has no idea what is happening on the
client,
the
Session ends 20 (by default, and according to your web.config file)
minutes
after the last Request from that user. So, again, are you sure it is NEVER
firing?
HTH,
Kevin Spencer
Microsoft FrontPage MVP
Internet Developer
http://www.takempis.com
Some things just happen.
Everything else occurs.
I've got an ASP.NET page with a counter subtraction routine in the
Session_End method in the Global.asax.cs:
protected void Session_End(Object sender, EventArgs e)
{
ulong curUsers;
Application.Lock();
curUsers = (ulong)Application["curUsers"];
curUsers--;
Application["iCurUsers"] = curUsers;
Application.UnLock();
}
Basically, this is supposed to keep track of the number of users that
are
logged into the system by keeping track of the number of open
sessions --
except that the Session_End NEVER fires. I've checked my web.config
file
and it does show the mode as InProc:
<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
cookieless="false"
timeout="20"
/>
Is there something else I missed??