Patrick,
Thanks for you patience !
Session.Timeout is now set to 5 Mn in each global.asax.
Here's a sample web.config and global.asax
----------------------------------------------------------------------------
-----
*********** global.asax *************
<%@ Import Namespace="System.Web.mail" %>
<SCRIPT LANGUAGE="VB" RUNAT="Server">
'Exécuté chaque fois qu'un nouvel user se connecte
Sub Session_Start
Dim iiNbActiveUsers As Integer
Dim isGazette As String
iiNbActiveUsers = Application("ApplicationUsers")
iiNbActiveUsers = iiNbActiveUsers + 1
If iiNbActiveUsers <= 0 Then
iiNbActiveUsers = 1
End If
Application.Lock
Application("ApplicationUsers") = iiNbActiveUsers
Application.Unlock
Session.Timeout = 5
End Sub
'Exécuté chaque fois qu'un nouvel user se déconnecte ou part en timeout
Sub Session_End
Dim iiNbActiveUsers as Integer
iiNbActiveUsers = Application("ApplicationUsers")
iiNbActiveUsers = iiNbActiveUsers - 1
If iiNbActiveUsers < 0 then
iiNbActiveUsers = 0
End If
Application.Lock
Application("ApplicationUsers") = iiNbActiveUsers
Application.Unlock
End Sub
'Exécuté à chaque redémarrage de l'application (ou du serveur)
Sub Application_Start
Dim isServerStartDate as String
isServerStartDate = FormatDateTime(Now(),1) & " à " &
FormatDateTime(Now(),4)
Application.Lock
Application("ApplicationStartDate") = isServerStartDate
Application("ApplicationUsers") = 0
Application.Unlock
End Sub
'Exécuté à chaque arrêt de l'application (ou du serveur) sauf en cas de
crash
Sub Application_End
Application.Lock
Application("ApplicationUsers") = 0
Application.Unlock
End Sub
Sub Application_BeginRequest(Sender As Object, E As EventArgs)
End Sub
Sub Application_EndRequest(Sender As Object, E As EventArgs)
End Sub
Sub Application_Error(Sender As Object, E As EventArgs)
Dim isErrorText As String
Dim isUser As String
Dim iiIndex As Integer
Dim ioMailMessage As MailMessage
Dim ioException As Exception
ioException = Server.GetLastError().GetBaseException()
isErrortext = ""
isErrorText = isErrortext & "<b>Serveur :</b> " & Server.MachineName() &
"<br/>"
isErrorText = isErrortext & "<b>Page : </b>" & Request.Path & "<br/>"
isErrorText = isErrortext & "<b>Message :</b> " & ioException.Message &
"<br/>"
isErrorText = isErrortext & "<b>Source :</b> " & ioException.Source &
"<br/>"
isErrorText = isErrortext & "<b>Stack :</b> " & ioException.StackTrace &
"<br/>"
'--------- Gestion des messages SMTP -----------------------
isUser = Request.ServerVariables("AUTH_USER")
iiIndex = Instr(isUser,"\")
If iiIndex <> 0 Then
isUser = Mid(isUser,iiIndex+1)
End If
ioMailMessage = New MailMessage()
ioMailMessage.From = isUser
ioMailMessage.To =
ConfigurationSettings.AppSettings("SiteAdministrator")
ioMailMessage.Subject = "Erreur sur l'application " & chr(34) &
ConfigurationSettings.AppSettings("SiteName") & chr(34)
ioMailMessage.body = isErrorText
ioMailMessage.BodyFormat = MailFormat.Html
SmtpMail.SmtpServer="SMTPSERVER"
SmtpMail.Send(ioMailMessage)
ioMailMessage = Nothing
'------------------------------------------------------------
'On force un GC.Collect()
GC.Collect()
End Sub
</SCRIPT>
*********** web.config *************
<?xml version="1.0" encoding="windows-1252"?>
<configuration>
<appSettings>
<add key="SiteName" value="Comite du medicament et des dispositifs
medicaux steriles"/>
<add key="SiteAdministrator" value="webmaster@intranet" />
<add key="ActiveSite" value="1"/>
<add key="SiteRoot" value="/COMEDIMS"/>
<add key="SiteDatabase" value="Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\InetPub\WWWRoot\COMEDIMS\_database\site.mdb;"/>
<add key="UserDatabase" value=""/>
<add key="CookieName" value="COMEDIMS :: Preferences"/>
<add key="CurrentMessage" value="15-10-2003"/>
</appSettings>
<system.web>
<authentication mode="Windows"/>
<authorization>
<allow users="*"/>
</authorization>
<customErrors mode="Off"/>
<compilation debug="true">
<assemblies>
<add
assembly="System.DirectoryServices,Version=1.0.3300.0,Culture=neutral,Public
KeyToken=b03f5f7f11d50a3a"/>
</assemblies>
</compilation>
</system.web>
</configuration>
----------------------------------------------------------------------------
-----
I still can't figure why, even after setting timeout to 5 mn, session_onend
is not fired.
This keeps [Application("ApplicationUsers")] abnormally high. Any idea why ?
Thanks in davance,
J.Philippe