monitor file access

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Aug 2005
Posts: 206
Reputation: plazmo is an unknown quantity at this point 
Solved Threads: 16
plazmo's Avatar
plazmo plazmo is offline Offline
Posting Whiz in Training

monitor file access

 
0
  #1
Jan 22nd, 2006
im trying to find a way to do an action when someone accesses a image file.
example would be someone views 'http://site.com/image.jpg' then say i want to log who has veiwed this file in my database.
ive heard of ad sites doing somethign like this for tracking people but i have a different plan.
i want to avoid having to log it by calling the image from a page using params like 'http://site.com/log.aspx?img=image.jpg' i dotn want to do that.

anyone have ideas how to do this?
Reply With Quote Quick reply to this message  
Join Date: Jan 2006
Posts: 275
Reputation: f1 fan is an unknown quantity at this point 
Solved Threads: 11
f1 fan f1 fan is offline Offline
Posting Whiz in Training

Re: monitor file access

 
0
  #2
Jan 23rd, 2006
there is a way of doing this. I use it extensively for tracking as you mentioned. You need to use an http module. Change your image url in the webpage to http://site.com/notanimage.jpg then in your http module you check for the name, do whatever logging you need and then replace the request with the original url (http://site.com/image.jpg).

If you need code let me know and i will post some (have to change some of mine not to give commercial secrets away ) IT is only a few lines
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 1
Reputation: rkayasth has a little shameless behaviour in the past 
Solved Threads: 0
rkayasth rkayasth is offline Offline
Newbie Poster

Re: monitor file access

 
-1
  #3
Jan 2nd, 2009
Originally Posted by f1 fan View Post
there is a way of doing this. I use it extensively for tracking as you mentioned. You need to use an http module. Change your image url in the webpage to http://site.com/notanimage.jpg then in your http module you check for the name, do whatever logging you need and then replace the request with the original url (http://site.com/image.jpg).

If you need code let me know and i will post some (have to change some of mine not to give commercial secrets away ) IT is only a few lines
Hi,

Can you send the code snippet to me please on <EMAIL SNIPPED>

Thanx in advance..
Rgds,
Ravin
Last edited by peter_budo; Jan 11th, 2009 at 2:36 pm. Reason: Keep It On the Site - Do not post asking for an answer to be sent to you via email or PM.
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 130
Reputation: sedgey is on a distinguished road 
Solved Threads: 8
sedgey's Avatar
sedgey sedgey is offline Offline
Junior Poster

Re: monitor file access

 
0
  #4
Jan 15th, 2009
Hi,
Heres a simple way to do it without HttpHandlers or mapping extensions to the aspnet_isapi.dll.

1. Add a script manager to your page or master page (tut tut if don’t have one already, this is the AJAX revolution!) Make sure you set the EnablePageMethods property to true). Also make sure the script manager is inside your form tag.
2. Create a public static method in your code behind with [WebMethod] above it and add System.Web.Webservices to your usings. Add your handling code, you could update your database, increment a counter or write to a log file.
3. Add an image to your page which has an onload=”PageMethods.TheNameOfYourPageMethod” attribute.

here's a complete tutorial with code:

http://web2asp.net/2009/01/tracking-...-by-using.html
David Ridgway: so little daylight, too much caffeine
MCSD MCAD MCSE
http://web2asp.net
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC