PC Review


Reply
Thread Tools Rate Thread

session_start/session_end

 
 
Bruno
Guest
Posts: n/a
 
      3rd Apr 2006
We are attempting to automatically log users off from the Session_End event
in global.asax and set some values on session_start. It is not a critical
task, more of a housekeeping task so that we know if users have closed down
their browsers without logging off first. However, although the code seems
to run OK on our development servers (WinXP ASP.NET v. 1.1, SQL Server 2000,
IIS6), they don't seem to be firing on the live server despite sessions
working fine.

We are using ASP.NET v. 1.1 and SQL Server 2000 on a W2K3 server running IIS
6.

Here is the c# code we used:-

/// <summary>

/// We can log the user out here so that the database will
reflect the correct number

/// users logged in.

/// </summary>

/// <param name="sender"></param>

/// <param name="e"></param>

protected void Session_End(object sender, EventArgs e)

{

// If user id is not null, log them out automatically...

object oId = Session["CurrentUserId"];



try

{

if (oId != null)

{

SqlInt32 intUserId =
SqlInt32.Parse(oId.ToString());



SessionServer.LogOut(intUserId,
Session.SessionID);



LogWriter.InsertAuditTrail(TypeServer.AuditLevel.INFO,
intUserId, "Session logged out automatically.");

}

}



catch (Exception ex)
{LogWriter.InsertAuditTrail(TypeServer.AuditLevel.INFO, (null ==
oId)?SqlInt32.NullSqlInt32)oId, "Error logging session out
automatically.");}

}

Any ideas?



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Session_Start/Session_End Mufasa Microsoft ASP .NET 3 6th Sep 2007 06:04 PM
session_start/session_end Bruno Microsoft C# .NET 7 5th Apr 2006 02:31 PM
Session_Start. Need Help. Thank You. Shapper Microsoft ASP .NET 2 29th Apr 2005 04:57 PM
session_start Carmen Microsoft ASP .NET 1 5th Apr 2005 09:54 PM
HttpModule gets InProc Session_Start, not Session_End Steve Donnelly Microsoft ASP .NET 0 30th Aug 2003 11:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:55 PM.