Solved

ASP.NET website keeps logging hits

Posted on 2012-03-27
3
298 Views
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()
MyTable.InsertHit()
End If

An instance is still being inserted every minute. What am I missing?
0
Comment
Question by:fieldb1
  • 2
3 Comments
 
LVL 9

Expert Comment

by:darjimaulik
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.
0
 

Author Comment

by:fieldb1
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.
0
 
LVL 9

Accepted Solution

by:
darjimaulik earned 500 total points
ID: 37776661
Hi,

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.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now