aspx thread: Re: Web Root vs Application Root. Oh the pain of it all!
By putting the name of your application directory in the global.asax.vb
file, you'll be able to display "absolute" path for your application
Ex: in global.asax.vb
Application.Add("appDirectoryName","/VirtualDirectory")
In any aspx page juste user the application("appDirectoryName") in prefix
of any absolute path you wanna use
Ex:
<img src='<%=Application("appDirectoryName")%>/imagesdir/image1.jpg'>
Jonathan
> I have a website set up as follows:
> DomainRoot/VirtualDirectory
> The domain root resembles: http://mydomain.com
> The virtualdirectory is set up to be the root of an asp.net application.
> so: http://mydomain.com/VirtualDirectory is the root of my asp.net
a> pplication.
> I am using .net to generate a javascript menu system. Thus clicking a
link
t> o: pagename.aspx takes me to a page in the current directory. However,
I
h> ave a directory structure (don't we all)
> domainRoot/VirtualDirectory/SubDirectory1
d> omainRoot/VirtualDirectory/SubDirectory2
e> tc.
> From SubDirectory1 to get to a page in subdirectory 2 I must go up one
l> evel and then down into Subdirectory2, but from VirtualDirectory I must
g> o down into Subdirectory.
> To make this work I expect I can use '/' to represent 'go to the
a> pplication root'. Then I just put the path from the root to the place I
w> ant to go and it is always the same.
> Instead of going to the application root (VirtualDirectory) I go to the
D> omainRoot Directory.
> This would be fine if the code was not meant to be portable. I need to
be
a> ble to move the code to other servers, other domains etc. Sometimes it
m> ay be in a virtual directory, sometimes it may be in the web-root
d> irectory. I thought '/' would do this. It doesn't.
> I tried '~' but that is not recognized by browsers and since I am
g> enerating a string it just gets passed as '~'.
> How can I configure my server or application to only go to the root of
the
a> pp? Not the root of the web?