ASP.NET website keeps logging hits

Posted on 2012-03-27
Medium Priority
Last Modified: 2012-03-28
I created a procedure to insert a record (hit) into a database table each time the Session_Start event fires in the Global.asax file. However, an instance was being instance every minute (give or take).

I moved the procedure to the Page_Load event and added a condition so that the procedure is executed only if the session is new:

If Session("id") Is Nothing Then
Session("id") = guid.NewGuid()
End If

An instance is still being inserted every minute. What am I missing?
Question by:fieldb1
  • 2

Expert Comment

ID: 37775549
Is the website Live?

How to count sessions?
When you open a page in IE its one session, if you open the same page in Chrome its 2nd session if its open in FireFox its 3rd Session.
Means when ever your Page is opened in a new browser its a new session.

You can keep your code in Global.asax's Session_start event to store the session value in the database.
and you don't need to write your own code to assign a session id as System Generated Session IDs are always unique.

Open your page in 3 diff browsers and if you get 3 entries in DB then your code is working fine.
But if you keep the page open or move to a different page and then you get and extra entry then its an issue.

If you haven't opened the page and still you are getting the hits in database, then check if there is any external application hitting your website like any Network monitor.
You can get more details in IIS Logs about Who is hitting your website. in IIS Logs you can find the IPs and User Agent and you can find which app is hitting your website so frequently.

Author Comment

ID: 37776571
Thanks. I understand how session works. The problem is not with the website (which is live) not logging the hits, but rather with the pattern of hits that are being logged one minute apart, continuously, when the page is not being accessed (it is visited rarely by customers).  That is the problem I am having.

I originally put the code in the Session_Start event with no conditional logic. Please see my first post.

What could be causing the pattern of hits? It also seems that once an hour 15 consecutive hits are recorded one second apart, every hour, on the hour. Strange.

Accepted Solution

darjimaulik earned 2000 total points
ID: 37776661

You can keep the code in Session_start without conditional logic and do not assign the session id.it is autogenerated by system

for continuous hits :
It Looks like your site is hit by some site monitor. Which generally checks if the site is working or not. or some one is trying to check security of site.

How to find who is hitting?
Best way to find IIS Logs.
You can ask your Service provider to provide the logs.
IIS Logs always have IPs of Users and User Agents of the Users.

From User Agent you will come to know if the hits are coming from a user or a Bot (Like Google Bot or Yahoo Bot). if you find a user Agent which is unknown then it means there is a hacker trying to bring down your site.

if you find any issue with IP or User Agent you can block the same from IIS.

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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.

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This video tutorial shows you the steps to go through to set up what I believe to be the best email app on the android platform to read Exchange mail.  Get the app on your phone: The first step is to make sure you have the Samsung Email app on your …
From store locators to asset tracking and route optimization, learn how leading companies are using Google Maps APIs throughout the customer journey to increase checkout conversions, boost user engagement, and optimize order fulfillment. Powered …

622 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