Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 12:49 PM
Eranga Udesh
Guest
 
Posts: n/a
Default 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


  #2  
Old July 19th, 2005, 12:50 PM
Aaron Bertrand [MVP]
Guest
 
Posts: n/a
Default Re: Howto get the current file path with SSI

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" <eranga@omnibis.com> wrote in message
news:%23e6vsqrGEHA.1720@tk2msftngp13.phx.gbl...[color=blue]
> 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[/color]
_header.asp,[color=blue]
> 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[/color]
none[color=blue]
> gave me what I wanted. This is necessory, becase the location of[/color]
_header.asp[color=blue]
> and the file which includes that can vary.
>
> Please give me a help/clue as soon as possible.
>
> Thanks in advance!
> Eranga
>
>[/color]


 

Bookmarks

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles