Stop access to sub folder containing images RRS feed

  • Question

  • User1829208979 posted
    HI I am developing a web site that saves images uploaded by users in a folder. I have to display the uploaded images on some web pages. The folder structure is like this: [MyWebsite] --default.aspx --displayphotohere.aspx --[Photos] ----[A] ------image1.gif ------image2.gif ----[B] ------image3.gif ------image4.gif I want to display images on displayphotohere.aspx with some thing like this as well ~~~~~~~~~ Thanks in advance ~~~~~~~~ Sona
    Friday, June 11, 2004 9:16 AM

All replies

  • User-1122936508 posted
    You can not do what you want with the current setup that you have. When you include a tag in your HTML page the following happens: a) the browser downloads the HTML page. It sees the tag. b) the browser issues a new request for the image specified in the image tag. Now, all the web-server sees is a request for a webpage, and then a request for an image. It can not tell whether the second request is because the browser saw the tag in a webpage, or because someone typed in the URL directly into their browser. To do what you want, you'll need some kind of ASP or ASP.NET page that checks to see if the user is OK, then loads the image file, and streams it back to the user after setting the appropriate HTTP headers. Cheers Ken
    Saturday, June 12, 2004 8:28 AM
  • User1829208979 posted
    Hi Ken Thank you for your quick reply. I did implement the solution as you described and it works. I used the technique detailed in this article http://www.developer.com/net/asp/article.php/3098311 by Karl. However I have run into another problem. I am using something like this in a Datalist. The idea being that I can get different thumb nails according to the path that is passed in as a Query string. However the first image generated seems to be repeated always. I realise that this would be because the image is sent once to the Response.OutputStream. But I need to display different thumb nails for different products. Any help would be greatly appreciated. ~~~~~~~~~~~~~~~ Thanks in advance ~~~~~~~~~~~~~~~~~~ Sona
    Saturday, June 12, 2004 12:40 PM