473,387 Members | 1,501 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Howto get the current file path with SSI

Hi All,

In my ASP file, located at the "/test" directory of the website, I include
another ASP file as below.

<!--#include file="../templates/_header.asp"-->

Inside the _header.asp file, how can I get the current file (_header.asp)
directory? I need to get the web relative/absolute directory of _header.asp,
but instead even if I can get the physical directory location of that file
should be fine.

I tried Request.ServerVariables("") with almost all the variables, but none
gave me what I wanted. This is necessory, becase the location of _header.asp
and the file which includes that can vary.

Please give me a help/clue as soon as possible.

Thanks in advance!
Eranga
Nov 18 '05 #1
2 1759
You can't, since the ASP code inside the include file thinks it is being
executed from the file calling it. One thing you might consider is
declaring a variable in the parent file, and referencing it in the #include
file.

<%
scr = request.servervariables("SCRIPT_NAME")
includedPath = left(scr,instrRev(scr,"/")-1) & "/templates/_header.asp"
%>
<!--#include file="../templates/_header.asp"-->

(Then reference the includedPath variable within the include file.)

Next time, please take a look at your cross-post list. This has nothing to
do with databases or components, and certainly has nothing to do with
ASP.NET. Followups set to asp.general ONLY.

"Eranga Udesh" <er****@omnibis.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi All,

In my ASP file, located at the "/test" directory of the website, I include
another ASP file as below.

<!--#include file="../templates/_header.asp"-->

Inside the _header.asp file, how can I get the current file (_header.asp)
directory? I need to get the web relative/absolute directory of _header.asp, but instead even if I can get the physical directory location of that file
should be fine.

I tried Request.ServerVariables("") with almost all the variables, but none gave me what I wanted. This is necessory, becase the location of _header.asp and the file which includes that can vary.

Please give me a help/clue as soon as possible.

Thanks in advance!
Eranga

Nov 18 '05 #2
You can't, since the ASP code inside the include file thinks it is being
executed from the file calling it. One thing you might consider is
declaring a variable in the parent file, and referencing it in the #include
file.

<%
scr = request.servervariables("SCRIPT_NAME")
includedPath = left(scr,instrRev(scr,"/")-1) & "/templates/_header.asp"
%>
<!--#include file="../templates/_header.asp"-->

(Then reference the includedPath variable within the include file.)

Next time, please take a look at your cross-post list. This has nothing to
do with databases or components, and certainly has nothing to do with
ASP.NET. Followups set to asp.general ONLY.

"Eranga Udesh" <er****@omnibis.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi All,

In my ASP file, located at the "/test" directory of the website, I include
another ASP file as below.

<!--#include file="../templates/_header.asp"-->

Inside the _header.asp file, how can I get the current file (_header.asp)
directory? I need to get the web relative/absolute directory of _header.asp, but instead even if I can get the physical directory location of that file
should be fine.

I tried Request.ServerVariables("") with almost all the variables, but none gave me what I wanted. This is necessory, becase the location of _header.asp and the file which includes that can vary.

Please give me a help/clue as soon as possible.

Thanks in advance!
Eranga

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Joe Richett | last post by:
Hi all, I have a python program and I have some "user defined" command stored in a separate text file. Is there a builtin command with which I can load the "user defined"-file and execute every...
1
by: Eranga Udesh | last post by:
Hi All, In my ASP file, located at the "/test" directory of the website, I include another ASP file as below. <!--#include file="../templates/_header.asp"--> Inside the _header.asp file,...
1
by: Antonio Lopez Arredondo | last post by:
hi all !!! I need to copy a folder and its subfolders to another location; which class should I use ? could only find the System.IO.Directory.MOVE but don't know how to COPY. thanks in...
2
by: Jan | last post by:
Hi, What I want is to add a text file to my project which will be included/embedded in my exe file. So not a link to a text file in a folder but a text file physical in the exe. Is this...
1
by: Roy | last post by:
Hi, I have a problem that I have been working with for a while. I need to be able from server side (asp.net) to detect that the file i'm streaming down to the client is saved...
4
by: Ray Dukes | last post by:
What I am looking to do is map the implementation of interface properties and functions to an inherited method of the base class. Please see below. ...
8
by: Topper | last post by:
Hello. I have simple web folders structure: -ROOT - BIN WebService.dll WebService.asmx I need to use my WebService.dll not in bin folder - for example, in ROOT. How do i this? How can i do...
7
by: patrik.kahari | last post by:
Is there a c++ function similar to getcwd that does not give you the working directory but the directory or path of the currently running executable? I need this because im porting a game that...
7
by: dmitrey | last post by:
Hi all, I guess this question was asked many times before, but I don't know keywords for web search. Thank you in advance, D.
9
by: =?Utf-8?B?VGhvbWFzIFcuIEJyb3du?= | last post by:
"parez" wrote: Assembly.LoadWithPartialName does indeed work!! Now, why is this incredibly useful routine deprecated and we are instructed to use Assembly.Load instead which does not provide...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.