jack schitt
New member
BACKGROUND:
This is my code for checking if a request was referred locally of not:
Public Function IsForeignReferrer() As Boolean
Dim Referrer As Uri = My.Request.UrlReferrer
If Referrer IsNot Nothing Then
Return Not (Referrer.Host = My.Request.Url.Host)
Else
Return False
End If
End Function
This function is called by all pages the generate and return images.
For simplicity, I'll describe the workings of Image.aspx:
Without params, it show an image index in html.
1: With ?pid=..., it shows an html page with the image
2: With ?pid=...&mode=inline, it returns the actual jpeg/gif/png image content
3: With ?pid=...&mode=dl, it sets the Content-Disposition header to allow the file to be downloaded. Then goto 2
4: With ?pid=...&mode=thumb, it returns a small version of the actual jpeg/gif/png image content.
I've coded it to behave different if IsForiegnReferrer returns true:
1: (No change)
2: Returns a shrunken version of the actual jpeg/gif/png image content overlaid with a banner saying where it's hotlinked from.
3: Goto 1
4: (No change)
QUESTION:
Are there any tools out there that can help me test this? Right now, I'm testing it by setting up IsForeignReferrer() to always return true. I want to demonstrate it in action to my boss such as by embedding the image in a forum or something. I'd rather demonstrate it with a tool designed for this. The big one I need to show him is 3, linking to the image download option.
Any suggestions? Also, is this a good way to allow hotlinking whilst reducing the inherent bandwidth of hotlinking? I might also add an add banner to the hotlinked image.
I really should have proofread that before submitting this question...
This is my code for checking if a request was referred locally of not:
Public Function IsForeignReferrer() As Boolean
Dim Referrer As Uri = My.Request.UrlReferrer
If Referrer IsNot Nothing Then
Return Not (Referrer.Host = My.Request.Url.Host)
Else
Return False
End If
End Function
This function is called by all pages the generate and return images.
For simplicity, I'll describe the workings of Image.aspx:
Without params, it show an image index in html.
1: With ?pid=..., it shows an html page with the image
2: With ?pid=...&mode=inline, it returns the actual jpeg/gif/png image content
3: With ?pid=...&mode=dl, it sets the Content-Disposition header to allow the file to be downloaded. Then goto 2
4: With ?pid=...&mode=thumb, it returns a small version of the actual jpeg/gif/png image content.
I've coded it to behave different if IsForiegnReferrer returns true:
1: (No change)
2: Returns a shrunken version of the actual jpeg/gif/png image content overlaid with a banner saying where it's hotlinked from.
3: Goto 1
4: (No change)
QUESTION:
Are there any tools out there that can help me test this? Right now, I'm testing it by setting up IsForeignReferrer() to always return true. I want to demonstrate it in action to my boss such as by embedding the image in a forum or something. I'd rather demonstrate it with a tool designed for this. The big one I need to show him is 3, linking to the image download option.
Any suggestions? Also, is this a good way to allow hotlinking whilst reducing the inherent bandwidth of hotlinking? I might also add an add banner to the hotlinked image.
I really should have proofread that before submitting this question...