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




thanks,
Ram.
ram27Asked:
Who is Participating?
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.

milindsmCommented:
Use Application variable. On every page visit, increase the value of this variable. You can read/write this value from/to database as well....!!!
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

tobzzzCommented:
I would recommend you store this in a database and do this in a global.asa:
<SCRIPT LANGUAGE="VBScript" RUNAT="Server">
Sub Session_OnStart
      Application.lock
            'UPDATE dbname SET visitCount = visitCount+1
      Application.unlock
End Sub
</SCRIPT>
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
0
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,
i..e,
in global.asa:
 Sub Session_OnStart
      Application.lock
           visitCount = visitCount+1

            'UPDATE dbTable
                SET visitCount = visitCount
      Application.unlock
//strore it in seesion varible to access it on default webapage to display the count
Session("TotalCount")= visitCount;
End Sub
Please confirm
0
tobzzzCommented:
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.
0
ram27Author Commented:
hi Tobazz,
My requirement is display the total number of visits to the website( per session regarless of user).


thanks,
0
tobzzzCommented:
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.
0

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
ASP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.