دوست من
سلام
لطفا بجای ایجاد تاپیک مجدد مطالبتون رو توی همون تاپیک قبلی پیگیری کنید
روش ایجاد شمارنده رو هم بنده همونجا توضیح دادم
الان مجبور شدم تند تند باز واست بنویسم
کد پایین کد فایل Global.asax هست
<%@ Application Language="VB" %>
<script runat="server">
Public sitecounter As Integer
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
sitecounter = 0
Application.Add("counter", sitecounter)
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)
sitecounter = Application.Item("Counter")
sitecounter = sitecounter + 1
Application.Remove("Counter")
Application.Add("counter", sitecounter)
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.
End Sub
</script>
هر جای برنامه ات هم که خواستی استفاده کنی اینجوریه
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim k As Integer
k = Application.Item("Counter")
Label1.Text = Str(k)
End Sub
البته این کد رو از این بهتر هم میشه نوشت ، اما چون هم شما عجله ندارید و هم من Visual Studio دم دستم نیست اینجور نوشتم که مطمئن باشم کار می کنه !!
موفق باشید