Board index » Web Programming » Application root

Application root

Web Programming129
Outside of ~, does anyone have tips on handling directory structure? I'm

considering adding a parameter in web.config called rootDirectory then

tacking it to relative paths as needed.



Any problems with this?



Thanks,

Brian


-
 

Re:Application root

Why do you not want to use ~ ?





"Brian" <brian@nospam.com>wrote in message

Quote
Outside of ~, does anyone have tips on handling directory structure? I'm

considering adding a parameter in web.config called rootDirectory then

tacking it to relative paths as needed.



Any problems with this?



Thanks,

Brian







-

Re:Application root

Well, I'm not quite sure. I don't understand the entire virtual path thing.

But from what I understand, ~ works in preprocessing but not in html. So

css, images, etc are left broken.



The immediate concern is to address the VS 2005 developer server. It runs

the project not from / but from /$(project)/ The project name must be

inserted into every URL. There are workarounds. One suggestion on the net

invoked the developer server executable with arguments to run the project as

the root url. IIS is always a choice. But I'd rather handle it in the

developer server.



Another concern is the portability of the site should it move to a new

location.



"Arthur Dent" <hitchhikersguideto-news@yahoo.com>wrote in message

Quote
Why do you not want to use ~ ?





"Brian" <brian@nospam.com>wrote in message

news:7HLMf.2899$xS5.463@tornado.socal.rr.com...

>Outside of ~, does anyone have tips on handling directory structure? I'm

>considering adding a parameter in web.config called rootDirectory then

>tacking it to relative paths as needed.

>

>Any problems with this?

>

>Thanks,

>Brian

>









-

Re:Application root

Well, in my experience the ~ resolves exactly like you need, to / (if your

project is the default site) or to /yourProjectName/ (if it is a

sub-directory).

This is a runtime resolution, so if you move the site, it will still work. I

HAVE seen some weird things with rendering of ~ in FireFox in (forexample)

the NavigateUrl

property of the HyperLink control (why, i dont know, never bothered to debug

for firefox). That was 2003 though, havent tried to recreate in 2005.



For html elements such as images, it is actually pretty easy to work

around.... you could do one of two things....

write your image as either of the following:

<asp:image id=myImage runat=server imageurl="~/images/myImage.gif" />

or

<img src='<%= ResolveUrl("~/images/myImage.gif") %>' />



As a result of the ASP/FireFox rendering bug above, i have some code which

dynamically generates the full url for the approot

(essentially the same idea as ResolveUrl("~")). If you would like that code,

email me, and ill send you the code,

but like i said above, it may not be necessary anymore in 2005.





"Brian" <brian@nospam.com>wrote in message

Quote
Well, I'm not quite sure. I don't understand the entire virtual path

thing. But from what I understand, ~ works in preprocessing but not in

html. So css, images, etc are left broken.



The immediate concern is to address the VS 2005 developer server. It runs

the project not from / but from /$(project)/ The project name must be

inserted into every URL. There are workarounds. One suggestion on the

net invoked the developer server executable with arguments to run the

project as the root url. IIS is always a choice. But I'd rather handle

it in the developer server.



Another concern is the portability of the site should it move to a new

location.





-