Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ASP.NET website keeps logging hits

Posted on 2012-03-27
3
Medium Priority
?
311 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

730 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