473,406 Members | 2,847 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,406 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 1760
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.