Hello people, first, I'm new with ASP... I have a page that have some included txt contenet on it... I use <!--#include file="somefile.txt"--> Code (markup): for that, and it works fine, so that's cool. Now what I need is to disable direct opening of that somefile.txt file. So I want above code to work on page, as it is now, but I need to disable if someone types www.mysite.com/somefile.txt to open that file in the browser. So I guess I need to set something like HTTP acess for that file, but I have no clue how to do it on ASP server, so can you help me with this?.. Or if you know any other solution for this (maybe somehow just to hide link from page source code so that visitors can't see where it is, but I think this is not possible)
In addition the: <!--#include file="somefile.txt"--> code should not be visible by the user within the source code as it will be executed by the server.
If you change the name to somefile.asp that will not display the text even if the person knows the url of the file.
One common cross-HTTP-server compatible method of dealing with this issue is to just stuff included files outside of the document root. So, if your pages are being served from c:/IIS/docroot/ you might make a special includes directory at c:/IIS/includes/. No one can directly access anything in your includes directory unless you're running a broken or buggy version of IIS, but your scripts should still be able to.