Wrox Programmer Forums
|
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
 
Old January 16th, 2004, 11:15 AM
Registered User
 
Join Date: Jan 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to glezmart
Default How count session connected to web ?

How count session connected to web site using the seccion object o application object?

 
Old January 16th, 2004, 12:05 PM
Authorized User
 
Join Date: Dec 2003
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

 
Old January 16th, 2004, 01:02 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Here's an article that explains all about it...

http://imar.spaanjaars.com/ViewConte...=4&CATEGORY=12
 
Old January 16th, 2004, 02:55 PM
Registered User
 
Join Date: Jan 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to glezmart
Default

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..

 
Old January 16th, 2004, 02:55 PM
Registered User
 
Join Date: Jan 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to glezmart
Default

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

 
Old January 16th, 2004, 02:56 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

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


 
Old January 16th, 2004, 03:03 PM
Registered User
 
Join Date: Jan 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to glezmart
Default

this is the replay that i need... that and the user online would like obtain this too..

 
Old January 16th, 2004, 03:19 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

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.

 
Old January 16th, 2004, 03:47 PM
Registered User
 
Join Date: Jan 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to glezmart
Default

sorry

i would like obtain the current session in my web site ....

 
Old January 16th, 2004, 03:59 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

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")






Similar Threads
Thread Thread Starter Forum Replies Last Post
session variable content count cygnusx04 Classic ASP Basics 3 October 24th, 2004 11:43 AM
Session management in ASP .Net with Multiple web s r_ganesh76 General .NET 1 September 9th, 2004 07:09 AM
Session States, Global. asax and web.config ohmbhu General .NET 2 July 1st, 2004 09:15 AM
session time out in web.xml ferozklm J2EE 0 May 27th, 2004 05:57 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.