Stopping someone accessing images directly

Discussion in 'C#' started by yorks45, Jan 25, 2007.

  1. #1
    Hi all

    just posted this in the HTML forum then saw this forum which seems more relevant...


    I have a directory full of images on a webserver. I want to prevent people who are not logged into the website to be able to access these images directly ie

    http://www.mywebsite.com/images/tree.jpg

    If they have logged in they can access images this way but if not they cant. I am using ASP and a windows server

    Anyone got any ideas ?

    thanks
     
    yorks45, Jan 25, 2007 IP
  2. pr0xy122

    pr0xy122 Peon

    Messages:
    1,649
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    0
    #2
    well I know there is something in Cpanel that can do this. But i am not so sure about the logged in/out thing, I think it is a global condition.
     
    pr0xy122, Jan 25, 2007 IP
  3. yorks45

    yorks45 Peon

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    yes but I need the access to be controlled by the ASP, ie if they are logged on then they can view the files
     
    yorks45, Jan 25, 2007 IP
  4. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,606
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    #4
    Classic asp or asp.net? I know asp.net 2005 allows you to control object's permissions in a website (as in if you have the role "general" or even have any roll, you can view certain things)

    I would look into the asp.net 2005 Sitemap or Web.Config for management. Otherwise, classic ASP i bet you could write a handler for IIS... but this could be a trickier solution. Would if you converted your images to BLOBS in a DB and only served them if they were logged in?
     
    ccoonen, Jan 25, 2007 IP