Solved

Can I call an asp function from an html page?

Posted on 2015-01-07
6
114 Views
Last Modified: 2015-01-08
Hi,

This is probably a really stupid question, however, I'm not very familiar with ASP. Is there any way that I can use an ASP function to count the number of hits to an html page, and display those results on a separate page? I don't want to have a visual hit counter, so I was going to display the results on a separate page. Someone told me I would have to convert the html page to an asp page in order for it to work. Is that correct? Is there any other way I could do it? I can't use 3rd party systems to gather the info.
0
Comment
Question by:savache27
6 Comments
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 40536173
If you want to count the hits, then all you need to do is keep the counts in a file or database table on the server and update it for every page request, For the display pag you just read the file or query the DB for the values.

Cd&
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 40536175
That is correct.  HTML by itself does not support any kind of programming except for javascript in the browser.  The server logs usually keep track all accesses so if you can find a log program that will process your server logs, you can find the info there.
0
 
LVL 33

Expert Comment

by:Big Monty
ID: 40536194
it would make your life that much easier to use some kind of server side language, such as classic asp, that way you can easily connect to a database on your server and store the info there. You could look into client side data storage, but that could get complicated if you're not familiar with the concept.

I found this tutorial that may help get you going in the right direction. It basically collects a lot of user stats, you could extract just the pieces you need for just a hit counter.

http://classicaspreference.com/aspexamples/classic_asp_track_visitors.asp
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 34

Accepted Solution

by:
Paul MacDonald earned 500 total points
ID: 40536267
"I can't use 3rd party systems to gather the info."
This is a shame, because Google Analytics would be the easiest way to do something like this.  If you mean you can't use a third-party product on the Internet, consider Piwik, which can be installed on your own network, so you have complete control over it.

If you really can't use a third-party solution, you could create a second web site that DOES use ASP/ASP.Net, then include a reference to a page on the the ASP site from the HTML site.  Every time a page on the HTML site loads, it calls the ASP site and the ASP site registers the hit.  The ASP site can record the name of the calling page and update a database to keep track of the page, date/time, etc.
0
 

Author Closing Comment

by:savache27
ID: 40538853
Thanks for all the responses. I ended up creating an ASP page and included a reference to it from the HTML page like paulmacd suggested.
0
 
LVL 34

Expert Comment

by:Paul MacDonald
ID: 40538861
Thanks for the points.  Happy to help.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question