Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 1.0
This is the forum to discuss the Wrox book Beginning ASP.NET 1.0 with C# by Chris Goode, John Kauffman, Christopher L. Miller, Neil Raybould, S. Srinivasa Sivakumar, Dave Sussman, Ollie Cornes, Rob Birdwell, Matt Butler, Gary Johnson, Ajoy Krishnamoorthy, Juan T. Llibre, Chris Ullman; ISBN: 9780764543708
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 1.0 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 May 20th, 2004, 09:29 PM
Registered User
 
Join Date: May 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to arqa
Default Using Application For Site Counter

i Am New ASP.NET Using C# .
i like to make A site That count the User Login An Exit
for Exaple If A User Logins Its Increments And When a User Logout
the Current Users Amount Must Decremented .
I Use Such A Underneath Code For It But It Is Not Work Correct.
Please Help me Any One
 void Application_OnStart()
    {
       if(Application["visitors_all"]==null)
          {
            Application.Lock();
            Application["visitors_all"]=1;
            Application["visitors_now"]=1;
            Application.UnLock();
          }
    }
/************************* Session ************************************/
     void Session_OnStart() {
         // Session start-up code goes here.
         Application.Lock();
         Application["visitors_now"]=(Int32)Application["visitors_now"]+1;
         Application["visitors_all"]=(Int32)Application["visitors_all"]+1;
         Application.UnLock();
     }
/************************* Session On End ************************************/
     void Session_End() {
         // Session clean-up code goes here.
           int i=(Int32)Application["visitors_now"]-1;
           Application.Lock();
           Application["visitors_now"]=i; // (Int32)Application["visitors_now"]-1;
           Application.UnLock();
     }

 
Old May 21st, 2004, 11:27 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

the codes look fine, Do u get any error?!

Always:),
Hovik Melkomian.
 
Old May 24th, 2004, 04:42 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

What Session model are you using? Session_End will only work with a session setting of inproc. You can also take a look at the following three articles for a more detailed description og a Session Counter.

http://Imar.Spaanjaars.Com/QuickDocID.aspx?QUICKDOC=238
http://Imar.Spaanjaars.Com/QuickDocID.aspx?QUICKDOC=227
http://Imar.Spaanjaars.Com/QuickDocID.aspx?QUICKDOC=223

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference between web application and web site manojm39 ASP.NET 2.0 Basics 2 August 10th, 2007 09:06 AM
Web Application site with Dreamweaver? Jacky Kenna Dreamweaver (all versions) 1 April 6th, 2005 04:16 PM
How I Can Setup A Counter Using ASPX Application O yoord ADO.NET 1 May 29th, 2004 04:35 AM
Developing a web site not a web application mkerchenski ASP.NET 1.0 and 1.1 Basics 8 May 25th, 2004 09:03 AM
Site Hit Counter shmacgregor ASP.NET 1.0 and 1.1 Basics 9 November 4th, 2003 08:56 PM





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