17-10-12, 02:08 PM
سعود كتب :Global.asax
فيها عدة احداث حتما ان اطلعت عليها ستعرفها تلقائيا انظر للملف لدي
كود :
<%@ Application Language="VB" %>
<script runat="server">
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs on application startup
Application("activeuser") = 0
End Sub
Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs on application shutdown
End Sub
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs when an unhandled error occurs
End Sub
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs when a new session is started
Session("start") = DateTime.Now
Application.Lock()
Application("activeuser") = Convert.ToInt32(Application("activeuser")) + 1
Application.UnLock()
End Sub
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs when a session ends.
' Note: The Session_End event is raised only when the sessionstate mode
' is set to InProc in the Web.config file. If session mode is set to StateServer
' or SQLServer, the event is not raised.
Application.Lock()
Application("activeuser") = Convert.ToInt32(Application("activeuser")) - 1
Application.UnLock()
End Sub
</script>
وضمن حدث تحميل الصفحة الرئيسية
كود :
If Not IsPostBack Then Dim i As Integer = Convert.ToInt32(Application("activeuser"))
' Response.Write("عدد الزوار الان: " & i.ToString())
' Application("activeuser") += 1
visit.InnerText = "عدد الزوار الان: " & i.ToString
End If
شكرا اخي العزيز سعود .. لكن المشكلة انها تنفذ فقط عند دخول المستخدم و لا يتم تنفيذ اي شيء عند خروجه

اتمنى منك ان تنظر الى المشروع و ان تقوم بالتعديل عليه اذا كنت قد اخطأت بشيء
شكرا مرة اخرى
http://vb4arb.com/vb/uploaded/65_11350468488.rar
الشمس اجمل في بلادي من سواها .. و الظلام
حتى الظلام هناك اجمل فهو يحتضن العـــراق :o
حتى الظلام هناك اجمل فهو يحتضن العـــراق :o
