I have been working w/ asp for the last couple of years and i always set up a certian directory structure.
Documents - All my content pages
Include - All files that need to be included, javascirpt, css, vb
Security - Log in Files
Images - Images
I have my set set up and i seem to be having problems getting my css file to work in development mode. If i publish the web site and access it from a remote server then it works fine but locally it does not take the css. Also the images seem to be off. I just went into the css editor and added the image but it does not take. It displays Images/Backgound.gif when it needs to be /Images/Background.gif.
Has any 1 else had problems w/ links to pages. It seems like when i try to correct the links then i can publish the web site because those links dont exists.
How are you pathing them?
When you dev local, the path is often /localhost/site but when you publish the site is /site. That means that things like "~" can be tricky... "" is the root when it's its own domain but "/site/" may be the root now...
Watch those things... see what you are getting and code them carefully.
Server.MapPath("~") and Server.MapPath("~/") are different as well.
well it seems that if i do this ../ it is working correclty on both ends but there are still some inconsistencies on the site. I was told by someone else to try ../ but a few years ago i stopped using that method and used / to take me to the root. Someone told me not to use ../ a few years back even though it works it was a bad practice.
Any thoughts toward this?
Ok here is my finding and im just wondering if there is any way around this so i dont have to constently change the pathing on the web site as i go from development to live.
When in development i have to path like this
/Website1/Include/HomeWeb.css
Where Website1 is the name of the web site. Now this works when i am running pages directly from VS. But when i publish the web site i have to change the path to this
/Include/HomeWeb.css
Now i would prefer not to have to change the pathing evertime.
Is there a solution to this problem??
Thanks
Server.MapPath("~/include1/blah")
The ~ tells it to start at the root of the APP. As long as none of the subfolders/dirs (ie Include) are virtual then this will work fine, or should
0 comments:
Post a Comment