Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ASP.NET website keeps logging hits

Posted on 2012-03-27
3
Medium Priority
?
312 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 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

782 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