Solved

ASP.NET website keeps logging hits

Posted on 2012-03-27
3
302 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
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…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…
A short film showing how OnPage and Connectwise integration works.

919 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

18 Experts available now in Live!

Get 1:1 Help Now