How can I safely link to ASP classic files that contain files outside the root directory?

I would like all my ASP files to include files outside the root directory. This ensures that no include files can be called directly through the URL.

What is the best way to do this?

I know that I can use a virtual directory to link to a folder with folders outside the web root directory, but it doesn’t still allow direct access to this directory through the URL? Perhaps I do not understand the nature of virtual directories.

+3
source share
3 answers

, " " IIS, - include, filesystemobject. , .

, , MSDN.

, Classic ASP, , , include , . , , - , , .

+2

:

( )

. "" - , "" . , / .

- - c:\websites\example.com. example.com, . , FileServerA D:\MyWebsiteIncludes. UNC \ FileServerA\D $\ MyWebSiteIncludes , \ FileServerA\MyWebsiteIncludes On -, , . , .

+2

, Diodeus ', .

/:

E:\includes\
           \include.asp
           \another.asp
E:\websites\
           \business-website.com\
                                \config.asp
                                \default.asp
           \personal-website.com\
                                \config.asp
                                \default.asp
           \whatever-website.com\
                                \config.asp
                                \default.asp

- IIS

business-website.com -> E:\websites\business-website.com\
     v. dir /include -> E:\includes\
personal-website.com -> E:\websites\personal-website.com\
     v. dir /include -> E:\includes\
whatever-website.com -> E:\websites\whatever-website.com\
     v. dir /include -> E:\includes\

: .

default.asp

Files in current directory:
<!-- #include file="config.asp" -->

Files in current directory (using virtual path):
<!-- #include virtual="/config.asp" -->

Files in include directory:
<!-- #include virtual="/include/include.asp" -->

include.asp

Files in current directory:
<!-- #include file="another.asp" -->

Files in current directory (using virtual path):
<!-- #include virtual="/include/another.asp" -->

Files in root application:
<!-- #include virtual="/config.asp" -->

.

0

Source: https://habr.com/ru/post/1699280/


All Articles