| | |
monitor file access
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
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?
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?
•
•
Join Date: Jan 2006
Posts: 275
Reputation:
Solved Threads: 11
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
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
•
•
Join Date: Jan 2009
Posts: 1
Reputation:
Solved Threads: 0
•
•
•
•
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
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.
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
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
![]() |
Similar Threads
- problems with reading random access line from a file (C++)
- Printing file access permission.... (Shell Scripting)
- how to set file access time (C)
- Random shared file access details....... (Visual Basic 4 / 5 / 6)
- how willl i be able to save a specific record into my database file in ms access (Java)
- file access problem(access and oracle) (C++)
Other Threads in the ASP.NET Forum
- Previous Thread: Search users(string) in XML
- Next Thread: Installation of .net framework programetically
| Thread Tools | Search this Thread |
.net 2.0 3.5 ajax alltypeofvideos appliances asp asp.net beginner box browser businesslogiclayer button c# cac checkbox class commonfunctions compatible content contenttype control countryselector courier dataaccesslayer database datagrid datagridview datalist deployment development dgv dialog dropdownlist dropdownmenu dynamic dynamically edit embeddingactivexcontrol fileuploader fill findcontrol flash flv formview gridview gudi iis javascript list listbox login menu microsoft mouse mssql nameisnotdeclared news novell numerical opera order panelmasterpagebuttoncontrols problem radio ratings redirect registration relationaldatabases reportemail schoolproject search security serializesmo.table sessionvariables silverlight smoobjects software sql sql-server sqlserver2005 ssl tracking treeview validatedate validation vb.net videos vista visual-studio visualstudio vs2008 web webapplications webarchitecture webdevelopment webprogramming webservice wizard xsl





