 |
| ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

January 16th, 2004, 11:15 AM
|
|
Registered User
|
|
Join Date: Jan 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
How count session connected to web ?
How count session connected to web site using the seccion object o application object?
|
|

January 16th, 2004, 12:05 PM
|
|
Authorized User
|
|
Join Date: Dec 2003
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
You will want to use the application on_start() method. Be sure it is saved in your global asa file. Then write a routine that increments a counter each time the application is accessed.
Let me know if this helps
John
|
|

January 16th, 2004, 01:02 PM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
|
|

January 16th, 2004, 02:55 PM
|
|
Registered User
|
|
Join Date: Jan 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
yes, that true...
but i wanna do this in a web services
sommething like this
[ WebMethod(Description="Per session Hit Counter",EnableSession=true)]
public int SessionHitCounter()
{
if (Session["HitCounter"] == null)
{
Session["HitCounter"] = 1;
}
else
{
Session["HitCounter"] = ((int) Session["HitCounter"]) + 1;
}
return ((int) Session["HitCounter"]);
}
this is the visitant's counter...
no i wanna obtain the the session online...
tahnk for for your response..
|
|

January 16th, 2004, 02:55 PM
|
|
Registered User
|
|
Join Date: Jan 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
yes, that true...
but i wanna do this in a web services
sommething like this
[ WebMethod(Description="Per session Hit Counter",EnableSession=true)]
public int SessionHitCounter()
{
if (Session["HitCounter"] == null)
{
Session["HitCounter"] = 1;
}
else
{
Session["HitCounter"] = ((int) Session["HitCounter"]) + 1;
}
return ((int) Session["HitCounter"]);
}
this is the visitant's counter...
no i wanna obtain the the session online...
thanks for for your response..
Francisco
|
|

January 16th, 2004, 02:56 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
If you don't save the value as soon as you reboot or stop IIS in any way the value will be lost. I suggest looking at Imar's hit counter to text file found here:
http://imar.spaanjaars.com/ViewConte...&CATEGORYID=12
|
|

January 16th, 2004, 03:03 PM
|
|
Registered User
|
|
Join Date: Jan 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
this is the replay that i need... that and the user online would like obtain this too..
|
|

January 16th, 2004, 03:19 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Quote:
quote:Originally posted by glezmart
this is the replay that i need... that and the user online would like obtain this too..
|
I do not understand the comment in red.
|
|

January 16th, 2004, 03:47 PM
|
|
Registered User
|
|
Join Date: Jan 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
sorry
i would like obtain the current session in my web site ....
|
|

January 16th, 2004, 03:59 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
in your global.asax file you need this
<script runat="server">
Sub Session_Start()
If Application("SessionCount") Is Nothing Then
Application("SessionCount") = 0
End If
Application("SessionCount") +=1
End Sub
Then in your page load sub you can add
lblSessionCount.Text = Application("SessionCount")
|
|
 |