944,026 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 4137
  • ASP.NET RSS
Jan 22nd, 2006
0

monitor file access

Expand Post »
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?
Similar Threads
Reputation Points: 23
Solved Threads: 16
Posting Whiz in Training
plazmo is offline Offline
206 posts
since Aug 2005
Jan 23rd, 2006
0

Re: monitor file access

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
Reputation Points: 26
Solved Threads: 11
Posting Whiz in Training
f1 fan is offline Offline
275 posts
since Jan 2006
Jan 2nd, 2009
-1

Re: monitor file access

Click to Expand / Collapse  Quote originally posted by f1 fan ...
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.
Reputation Points: 5
Solved Threads: 0
Newbie Poster
rkayasth is offline Offline
1 posts
since Jan 2009
Jan 15th, 2009
0

Re: monitor file access

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
Reputation Points: 68
Solved Threads: 9
Junior Poster
sedgey is offline Offline
130 posts
since Jan 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: Search users(string) in XML
Next Thread in ASP.NET Forum Timeline: Installation of .net framework programetically





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC