Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Remote Image Linking
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Remote Image Linking

 Post Reply Post Reply
Author
b_bonnett View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 16 April 2003
Location: New Zealand
Status: Offline
Points: 275
Post Options Post Options   Thanks (0) Thanks(0)   Quote b_bonnett Quote  Post ReplyReply Direct Link To This Post Topic: Remote Image Linking
    Posted: 18 June 2003 at 9:41pm
Can anyone tell me how to prevent remote image / file linking on a Windows server? I have been able to find how to do it on a non-Windows server but that isn't much use to me .

Thanks in advance,
Blair
Webmaster, The Plane Gallery
Greetings From Christchurch
Back to Top
Gullanian View Drop Down
Senior Member
Senior Member
Avatar

Joined: 04 January 2002
Location: England
Status: Offline
Points: 4373
Post Options Post Options   Thanks (0) Thanks(0)   Quote Gullanian Quote  Post ReplyReply Direct Link To This Post Posted: 19 June 2003 at 3:10am
If you mean hotlinking, I dont think there is really any way you can, however in ASP theres a handy FSO (file system object).  I think the best way of stopping hotlinking is to store the image path in a database, use FSO to move all images to another folder with a random name daily, and then change the database value
Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post Posted: 19 June 2003 at 8:02am

the FSO method would be a lot of overhead

and easy asp way would be like:

<%
'ShowImage.asp
RequestedImage = Request.QueryString("file")
ThisReferer = Request.ServerVariables("HTTP_REFERER")
MyDomain = "mydomain.com"  '<<== whatever your domain is, leave out the "www"

if Instr( ThisReferer, MyDomain ) then
       Response.Redirect(RequestedImage)
else
       Response.Redirect("/images/accessdenied.jpg")
end if
%>


So you would just code in:
<img src="ShowImage.asp?file=/images/someimage.jpg"/>

let me note that this is super slimmed down, but hopefully you get the idea

Contribute to the working anarchy we fondly call the Internet
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 19 June 2003 at 1:04pm
The only problem with that is it tells you the original image (ShowImage.asp?file=/images/someimage.jpg) in the querystring...
Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post Posted: 19 June 2003 at 2:01pm

lemme note again that i never posted that as "working/final" code, just a quick 5 mins of my time to display what can be done

with that said, you could do:

<%
'ShowImage.asp
RequestedImage = Request.QueryString("file")
ThisReferer = Request.ServerVariables("HTTP_REFERER")
MyDomain = "mydomain.com"  '<<== whatever your domain is, leave out the "www"
MyImageDirectory = "/thisdirectory/"

if Instr( ThisReferer, MyDomain ) then
       Response.Redirect(MyImageDirectory & RequestedImage)
else
       Response.Redirect("/images/accessdenied.jpg")
end if
%>

 

Now:
<img src="ShowImage.asp?file=someimage.jpg"/>

gives no idea what directory its in

Contribute to the working anarchy we fondly call the Internet
Back to Top
Gullanian View Drop Down
Senior Member
Senior Member
Avatar

Joined: 04 January 2002
Location: England
Status: Offline
Points: 4373
Post Options Post Options   Thanks (0) Thanks(0)   Quote Gullanian Quote  Post ReplyReply Direct Link To This Post Posted: 19 June 2003 at 2:08pm
Thanks morning Z, thats a great idea ive never thought of that before!
Back to Top
the boss View Drop Down
Senior Member
Senior Member
Avatar

Joined: 19 January 2003
Location: Saudi Arabia
Status: Offline
Points: 1727
Post Options Post Options   Thanks (0) Thanks(0)   Quote the boss Quote  Post ReplyReply Direct Link To This Post Posted: 03 July 2003 at 1:00am
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.