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#.开发者_如何学Python
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.
精彩评论