View Full Version : Disallowed parent path!!!
bostjank
10-19-2002, 05:09 PM
Hi!
When I try to open some of my pages I get this error mesasge:
************
Active Server Pages error 'ASP 0131'
Disallowed Parent Path
/admin/admin.asp, line 1
The Include file '../functions.asp' cannot contain '..' to
indicate the parent directory.
**************
I use this script to include a file:
<!--#include file="../functions.asp" -->
I followed the Microsoft's instructions on solving the problem (http://support.microsoft.com/default.aspx?scid=kb;en-us;Q226474) and tried this include script:
<!--#include file="/functions.asp" -->
But then I get new error message:
************
Active Server Pages error 'ASP 0130'
Invalid File attribute
/admin/admin.asp, line 1
File attribute '/functions.asp' cannot start with forward slash or back slash.
************
The included file is used by pages in root directory as well as pages in 'admin' directory. I can solve the problem by having all files in root directory, but there are too many files and I need to organize them.
I cannot simply enable parent paths on IIS, because my pages are hosted on a public server. Can anybody help me solve the problem?
Thanks,
Bostjan
.
whammy
10-19-2002, 05:13 PM
Hmm... have you tried include virtual?
<!-- #include virtual="/functions.asp" -->
bostjank
10-19-2002, 05:31 PM
Yes, it was my mistake.
But another problem occured. 'include virtual' work on a public computer, but on my machine (Windows Me, PWS) the include file cannot be found.
It is very important to me that it work on my machine, because I have a dial-up connection.
bostjank
10-19-2002, 05:35 PM
How can I use Server.MapPath to access a database in another folder (../database)?
whammy
10-19-2002, 09:52 PM
Are you using brinkster?
I had problems with simple connections there... this is rather lengthy, but this works:
Set Conn = Server.CreateObject("ADODB.Connection")
sConnString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source="
sMapPath = Server.MapPath("\")
sMapPath = Mid(sMapPath, 1, InStrRev(sMapPath,"\")-1) & "\database\databasename.mdb;" & _
"Persist Security Info=False;"
sConnString = sConnString & sMapPath
Conn.Open sConnString
whammy
10-19-2002, 10:41 PM
P.S. I had no problem using include virtual on my machine (and strangely enough, I'm using Win ME and PWS too!).
Probably you don't have the directory structure set up the same way on your machine, or you have the path wrong in the include statement.
bostjank
10-20-2002, 03:27 PM
Thje folder structure is identical, and included file is found if I use 'include file' instead of 'include virtual'.
whammy
10-20-2002, 03:40 PM
I'd have to look at the code in question... like I said, I tested it on my machine and it works both ways, so I'm not sure what's happening without looking at the code.
bostjank
10-20-2002, 05:02 PM
This is structure of my web
Root folder
- _private
- admin
I have admin.asp in admin folder and datcalc.asp in _private folder.
I sant to include datcalc.asp in admin.asp. If I use:
<!--#include file="../_private/datcalc.asp" -->
everything is OK. However I cannot use this include statement, because parent path is disallowed on a server where my web is published. That's why I use:
<!--#include virtual="/_private/datcalc.asp" -->
But I get thi error message
*******************
Active Server Pages error 'ASP 0126'
Include file not found
/MyWeb/admin/admin.asp, line 5
The include file '/_private/datcalc.asp' was not found.
*******************
And as I said - it works on public computer, but not on mine.
What am I missing?
Bostjan
whammy
10-20-2002, 08:11 PM
The answer is right there in the error (since it's obvious it's reading "MyWeb" as the root folder - which means your directory structure isn't the same as on your public server, like I suggested ;)):
<!-- #include virtual="/MyWeb/_private/datcalc.asp" -->
bostjank
10-20-2002, 08:37 PM
Thanks for your solution.
Do you know how could I use diferent include statements on my computer and on public server. I experimented with request.servervariables("server_name") but had no success, because all include statements are processed, no mater if there is an IF clause.
whammy
10-24-2002, 02:25 AM
Well, you might see what the path is to your page, and then use an if/then statement according to that.
Look into Server.RequestVariables("PATH_INFO")
And try something like this:
<%
Dim Item
For Each Item in Request.ServerVariables
For iCount = 1 to Request.ServerVariables(Item).Count
Response.Write(Item & " = " & Request.ServerVariables(Item)(iCount) & "<br />" & vbLf)
Next
Next
%>
That will give you all of the server variables that you can request from the HTTP header, and possibly give you some ideas as to which ones you can use to get the results you're looking for. And good luck. :D
vBulletin® v3.8.2, Copyright ©2000-2010, Jelsoft Enterprises Ltd.