aspx thread: Web Root vs Application Root. Oh the pain of it all!
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
application.
I am using .net to generate a javascript menu system. Thus clicking a link
to: pagename.aspx takes me to a page in the current directory. However, I
have a directory structure (don't we all)
domainRoot/VirtualDirectory/SubDirectory1
domainRoot/VirtualDirectory/SubDirectory2
etc.
From SubDirectory1 to get to a page in subdirectory 2 I must go up one
level and then down into Subdirectory2, but from VirtualDirectory I must
go down into Subdirectory.
To make this work I expect I can use '/' to represent 'go to the
application root'. Then I just put the path from the root to the place I
want to go and it is always the same.
Instead of going to the application root (VirtualDirectory) I go to the
DomainRoot Directory.
This would be fine if the code was not meant to be portable. I need to be
able to move the code to other servers, other domains etc. Sometimes it
may be in a virtual directory, sometimes it may be in the web-root
directory. I thought '/' would do this. It doesn't.
I tried '~' but that is not recognized by browsers and since I am
generating a string it just gets passed as '~'.
How can I configure my server or application to only go to the root of the
app? Not the root of the web?