Ayyash
Ayyash

Reputation: 4409

retrieve the url of the page an image sits on

I'm trying to log URLs that access broken images, using an HTTP module to catch those images when accessed.

How do you retrieve the URL where that image sits on? is there a way to do it the other way round too? That is, loop through images served in a URL and decide which ones are broken.

This is all in ASP.NET with C#.

Upvotes: 0

Views: 117

Answers (1)

Alconja
Alconja

Reputation: 14873

You should be able to work out what page requested a broken image by checking the Http Referrer (Request.UrlReferrer) in your HTTP Module when you detect the 404.

Doing it the other way around would be much more complicated since you'd have to parse the outgoing HTML.

Upvotes: 2

Related Questions