Relative path of folder
Hi,
This perhaps is a simple question, but it takes me almost a day to think about the solution. Would anyone give me a solution?
In my development server, the IIS points to a root and the folder structure look likes this:
Root
Folder 1 (under Root)
Folder A, Folder B (both under Folder 1)
Folder C, Folder D (both under Folder A)
a banner.ascx contains an image from Folder B, so I code in it "/Folder1/Folder B/pic1.jpg"
In my production server, the structure is a bit different:
Root
Folder A, Folder B (both under Root)
Folder C, Folder D (both under Folder A)
Therefore, when I move all web pages from development server to production, I need to change every path from "/Folder1/Folder B" to "../Folder B/" . I think this is not a good way to modify the path here and there, but how can I move the pages without changing the path ?
Please help me!!!!!
[935 byte] By [
THL] at [2007-11-11 7:21:30]

# 1 Re: Relative path of folder
Create a new virtual directory on your development server and make it the root folder of your application. So, instead of http://localhost/Folder1, the root becomes http://virtualdir/. You will be able to use the same code on your dev and production servers.
You may also find this technique helpful: http://www.aspnetpro.com/newsletterarticle/2003/11/asp200311kd_l/asp200311kd_l.asp
# 2 Re: Relative path of folder
Thanks Phil Weber again,
It seems that the virtual directory is feasible, but when I create another project, it requires to change the virtual directory again. That makes it quite complicated. However, I have read the article you show me, but the Tilde character could not work on the web page, I change the image URL to "~/Folder B/pic.jpg", but the picture doesn't load.
At last, I find in the article mentions the "../../" notation and I use it to modify the URL to "../../Folder B/pic.jpg", it works on both development and production server !!!! : )
So, I decide to use this notation.
THL at 2007-11-11 23:14:49 >
