Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Howto get the current file path with SSI

Reply
Thread Tools

Howto get the current file path with SSI

 
 
Eranga Udesh
Guest
Posts: n/a
 
      04-05-2004
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


 
Reply With Quote
 
 
 
 
Aaron Bertrand [MVP]
Guest
Posts: n/a
 
      04-06-2004
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" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
 
Eranga Udesh
Guest
Posts: n/a
 
      04-09-2004
Hi Aaron,

Thanks for the advice. Also I will make sure to check my cross-post list
next time.

Rgds,


"Aaron Bertrand [MVP]" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > 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
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How do I get the current path of my python file that is currentlyrunning. Arnau Sanchez Python 1 08-23-2007 03:06 PM
Path for SSI in htm file Poten Tate HTML 18 04-06-2007 05:54 AM
How can get the current virtual path without file name? farmer ASP .Net 10 10-24-2005 11:12 PM
get the path of current Java file directory Matt Java 1 06-06-2004 02:36 AM
Howto get the current file path with SSI Eranga Udesh ASP .Net 1 04-06-2004 05:18 AM



Advertisments