user count in classic ASP

i have classic asp website, it is a intranet (not internet) website. i want to do below:
 1. i want to dispaly total number of users accessed my website.
 2. I want to store user information who accessed my website in table.
Can you help me out with what would be the best place to write code.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Use Application variable. On every page visit, increase the value of this variable. You can read/write this value from/to database as well....!!!
Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.

I would recommend you store this in a database and do this in a global.asa:
Sub Session_OnStart
            'UPDATE dbname SET visitCount = visitCount+1
End Sub
That would be incrementing the visitor counter. Then I would use server variables to pick up other information like IP addess, browser, date and time and so forth.

Best of luck

/ Tobzzz
ram27Author Commented:
Hi tobzzz,

you mean
1. For "total number of users accessed my website":
  create table in databse with one cloumnas 'visitCount' and increment it per session,
in global.asa:
 Sub Session_OnStart
           visitCount = visitCount+1

            'UPDATE dbTable
                SET visitCount = visitCount
//strore it in seesion varible to access it on default webapage to display the count
Session("TotalCount")= visitCount;
End Sub
Please confirm
Yes, I actually on use it the session way to display "active" users, I have not inserted into a database as I use google tracking code and hosting stats to see this but it should work the same. It means you'll see site visitors, rather than page visitors as the global always kicks into play the first time a visitor hits your site.
ram27Author Commented:
hi Tobazz,
My requirement is display the total number of visits to the website( per session regarless of user).

OK, so you would store the visit in the database as I said, then query the database to show it in the page. If you stored it just in the global.asa it would be reset if you altered the global.asa.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.