Home > DeveloperSection > Forums > Find Out the URL of the webpage that image resides on
Monaj Singh
Monaj Singh

Total Post:41

Posted on    December-08-2014 2:11 AM

 ASP.Net Webforms 

 2 Reply(s)
 803  View(s)
Rate this:

I would like to make a 1 pixel image that will reside on the html page to track page activity I have a page http:/domain.com/mypage.htm and I want to add <img src='http://www.test.com/myimage.aspx' /> somewhere in its body


When page is triggered I render an one pixel transparent image. I'm having an issue finding out the URL of the page that image is on. HTTP_REFERER header carrier the true referer of the page, and HTTP_HOST carries the URL of the image itself.


Is there a way to find out the HTML page URL that the image is on?

Anurag Sharma
Anurag Sharma

Total Post:40

Posted on    December-08-2014 6:20 AM

If you can't find it on any http header, you can always send some information like <img src='http://www.test.com/myimage.aspx?page=mypage' />.


If you can use javascript though, you don't need to display an image, use an ajax request instead.

Lillian Martin

Total Post:27

Posted on    December-08-2014 7:35 AM

You can analysis the request headers of myimage.aspx, the Referer header is the HTML page URL you're looking for. Besides, I suggest adding a timestamp with the <img> src link, like this:


<img src="http://www.test.com/myimage.aspx?t=1234567890" />

So that every time you refresh the HTML page, the browser invoke a new request to the image.

Don't want to miss updates? Please click the below button!

Follow MindStick