Frustrated by relative paths - a way around this?
Question posted by: jason
(Guest)
on
July 19th, 2005 06:34 AM
Can anyone help me find a solution to quickly working out relative paths to
a folder in the root of my server...
Although it easy when you go - say - two levels down:
.../includes
it becomes increasingly difficult to ball park the folder when you go deeper
and wider down:
.../.../.../includes
....How do you guys get a quick fix on where the hell the folder or file is
and use that path in asp?
Thanks in advance
Jason
5
Answers Posted
<!--#Include Virtual="WebApp\includes\filename.asp"-->
"jason" <jason@catamaranco.com> wrote in message
news:OxKx6VvRDHA.1804@TK2MSFTNGP11.phx.gbl...[color=blue]
> Can anyone help me find a solution to quickly working out relative paths[/color]
to[color=blue]
> a folder in the root of my server...
>
> Although it easy when you go - say - two levels down:
>
> ../includes
>
> it becomes increasingly difficult to ball park the folder when you go[/color]
deeper[color=blue]
> and wider down:
>
> ../.../.../includes
>
> ...How do you guys get a quick fix on where the hell the folder or file is
> and use that path in asp?
>
> Thanks in advance
> Jason
>
>[/color]
Nooooooooooo - this is a poisoned chalice - as moving web hosts will create
additional problems....how do seasoned asp developers quickly ascertain the
relative path of a folder if they are scripting deep inside the folder
structure....I cannot believe Visual Interdev does not have a quick and easy
feature to do this? Or does it? Maybe I will be forced to scan for a 3rd
party application...
- Jason
"Tom B" <shuckle@hotmail.com> wrote in message
news:#2oD8bvRDHA.1868@TK2MSFTNGP11.phx.gbl...[color=blue]
> <!--#Include Virtual="WebApp\includes\filename.asp"-->
>
> "jason" <jason@catamaranco.com> wrote in message
> news:OxKx6VvRDHA.1804@TK2MSFTNGP11.phx.gbl...[color=green]
> > Can anyone help me find a solution to quickly working out relative paths[/color]
> to[color=green]
> > a folder in the root of my server...
> >
> > Although it easy when you go - say - two levels down:
> >
> > ../includes
> >
> > it becomes increasingly difficult to ball park the folder when you go[/color]
> deeper[color=green]
> > and wider down:
> >
> > ../.../.../includes
> >
> > ...How do you guys get a quick fix on where the hell the folder or file[/color][/color]
is[color=blue][color=green]
> > and use that path in asp?
> >
> > Thanks in advance
> > Jason
> >
> >[/color]
>
>[/color]
....Using a virtual path also has tricky implications for testing on a local
and remote machine.
I would have to re-code absolute paths each time I test on my local machine
and then re-adjust when I upload to target server...
- Jason
"Tom B" <shuckle@hotmail.com> wrote in message
news:#2oD8bvRDHA.1868@TK2MSFTNGP11.phx.gbl...[color=blue]
> <!--#Include Virtual="WebApp\includes\filename.asp"-->
>
> "jason" <jason@catamaranco.com> wrote in message
> news:OxKx6VvRDHA.1804@TK2MSFTNGP11.phx.gbl...[color=green]
> > Can anyone help me find a solution to quickly working out relative paths[/color]
> to[color=green]
> > a folder in the root of my server...
> >
> > Although it easy when you go - say - two levels down:
> >
> > ../includes
> >
> > it becomes increasingly difficult to ball park the folder when you go[/color]
> deeper[color=green]
> > and wider down:
> >
> > ../.../.../includes
> >
> > ...How do you guys get a quick fix on where the hell the folder or file[/color][/color]
is[color=blue][color=green]
> > and use that path in asp?
> >
> > Thanks in advance
> > Jason
> >
> >[/color]
>
>[/color]
I've always used virtual includes. My development machine is set up
identically to my production machine, so transferring to the production
server isn't a problem.
I believe(and could be wrong) that you are more likely to run into trouble
using relative paths, as I've seen frequent comments regarding using
includes in "higher" directories being disallowed by ISPs
"jason" <jason@catamaranco.com> wrote in message
news:ue$mUhvRDHA.1072@TK2MSFTNGP10.phx.gbl...[color=blue]
> Nooooooooooo - this is a poisoned chalice - as moving web hosts will[/color]
create[color=blue]
> additional problems....how do seasoned asp developers quickly ascertain[/color]
the[color=blue]
> relative path of a folder if they are scripting deep inside the folder
> structure....I cannot believe Visual Interdev does not have a quick and[/color]
easy[color=blue]
> feature to do this? Or does it? Maybe I will be forced to scan for a 3rd
> party application...
>
> - Jason
>
>
> "Tom B" <shuckle@hotmail.com> wrote in message
> news:#2oD8bvRDHA.1868@TK2MSFTNGP11.phx.gbl...[color=green]
> > <!--#Include Virtual="WebApp\includes\filename.asp"-->
> >
> > "jason" <jason@catamaranco.com> wrote in message
> > news:OxKx6VvRDHA.1804@TK2MSFTNGP11.phx.gbl...[color=darkred]
> > > Can anyone help me find a solution to quickly working out relative[/color][/color][/color]
paths[color=blue][color=green]
> > to[color=darkred]
> > > a folder in the root of my server...
> > >
> > > Although it easy when you go - say - two levels down:
> > >
> > > ../includes
> > >
> > > it becomes increasingly difficult to ball park the folder when you go[/color]
> > deeper[color=darkred]
> > > and wider down:
> > >
> > > ../.../.../includes
> > >
> > > ...How do you guys get a quick fix on where the hell the folder or[/color][/color][/color]
file[color=blue]
> is[color=green][color=darkred]
> > > and use that path in asp?
> > >
> > > Thanks in advance
> > > Jason
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]
A lot of it comes from choosing a folder structure that is logical with
elemens that are required to be referenced by other elements being placed
below them (deeper in the tree structure).
Of course for images and scripts etc. this becomes difficult.
It is hard to keep track of but if you drag and drop the file onto an HTML
page in Interdev then you can immdiately see the relative path.
IIS makes it hard because root relative paths (eg. starts with '/') do not
reference corretcly when debugging locally since the root relative path
refers to the website, not the web application. When you debug locally, what
was a website becomes a web application one folder deeper in the local IIS
and the root relative paths no longer apply.
Personally, I always use relative paths to avoid issues in debugging and
moving the site to another location even though it ultimately becomes harder
to manage during development.
Chris.
"jason" <jason@catamaranco.com> wrote in message
news:OpDWAuvRDHA.1572@TK2MSFTNGP12.phx.gbl...[color=blue]
> Ok - Tom - I'm going with your suggestion I just realised I was trying to
> put the full physical path in...instead of just the subfolder residing in
> the root of my server which matches my local root....damn, I'm slow! ;)
>
> "Tom B" <shuckle@hotmail.com> wrote in message
> news:eU43CovRDHA.2332@TK2MSFTNGP10.phx.gbl...[color=green]
> > I've always used virtual includes. My development machine is set up
> > identically to my production machine, so transferring to the production
> > server isn't a problem.
> > I believe(and could be wrong) that you are more likely to run into[/color][/color]
trouble[color=blue][color=green]
> > using relative paths, as I've seen frequent comments regarding using
> > includes in "higher" directories being disallowed by ISPs
> >
> >
> >
> > "jason" <jason@catamaranco.com> wrote in message
> > news:ue$mUhvRDHA.1072@TK2MSFTNGP10.phx.gbl...[color=darkred]
> > > Nooooooooooo - this is a poisoned chalice - as moving web hosts will[/color]
> > create[color=darkred]
> > > additional problems....how do seasoned asp developers quickly[/color][/color][/color]
ascertain[color=blue][color=green]
> > the[color=darkred]
> > > relative path of a folder if they are scripting deep inside the folder
> > > structure....I cannot believe Visual Interdev does not have a quick[/color][/color][/color]
and[color=blue][color=green]
> > easy[color=darkred]
> > > feature to do this? Or does it? Maybe I will be forced to scan for a[/color][/color][/color]
3rd[color=blue][color=green][color=darkred]
> > > party application...
> > >
> > > - Jason
> > >
> > >
> > > "Tom B" <shuckle@hotmail.com> wrote in message
> > > news:#2oD8bvRDHA.1868@TK2MSFTNGP11.phx.gbl...
> > > > <!--#Include Virtual="WebApp\includes\filename.asp"-->
> > > >
> > > > "jason" <jason@catamaranco.com> wrote in message
> > > > news:OxKx6VvRDHA.1804@TK2MSFTNGP11.phx.gbl...
> > > > > Can anyone help me find a solution to quickly working out relative[/color]
> > paths[color=darkred]
> > > > to
> > > > > a folder in the root of my server...
> > > > >
> > > > > Although it easy when you go - say - two levels down:
> > > > >
> > > > > ../includes
> > > > >
> > > > > it becomes increasingly difficult to ball park the folder when you[/color][/color]
> go[color=green][color=darkred]
> > > > deeper
> > > > > and wider down:
> > > > >
> > > > > ../.../.../includes
> > > > >
> > > > > ...How do you guys get a quick fix on where the hell the folder or[/color]
> > file[color=darkred]
> > > is
> > > > > and use that path in asp?
> > > > >
> > > > > Thanks in advance
> > > > > Jason
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]
|
|
|
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 196,994 network members.
Top Community Contributors
|