asp.net 2.0 Page Pathing Problems

I have been using asp for the last couple of years and just started to learn asp.net 2.0. I am having problems w/ the pathing of my files in the master page as well as the image links in the css file.

I have a folder called Include where i keep my master page and css page (not sure if there is a specific directory that needs to hold this stuff). In the master page i tell it to use the css file in that directory. But then when i load the default page of the web site, the master page is there but the css file is not rendering in development but if i publish the web site and then view it from a remote location the css file renders but the images in the css file do not. The image files look like this when i add it w/ the css editor images/backgroud.gif instead of /images/background.gif.

While this renders when i publish the web site it is not visible from the local
machine where its being developed which sucks because i have no way of knowing what the site looks like.

The next thing i did was move the master page and css file to the root of the web site. This allows the pages to be rendered w/ the css file but only those files located in the root. If i browse to a file say in /Documents/default.aspx, then it does not render the css file but renders the mater page.

Im not sure exaclty whats happening but i seem to be having some pathing issues. I like to set my web site up like this:
Documents --(contains all the content pages)
Security --(Contains all the log in pages)
Include --(contains the master pages, css files, In asp it contained my common functions and javascript)
images --(images)

I see in asp.net 2.0 and maybe 1.0 not sure did not use it, that some pages seem to be using the ~ character.

Any way im not sure but could some one run over pathing for me.

And do the master pages and css files need to be contained in a specific folder??

Thanks.Your problem probably lies in your directory structure. Try using ../images instead of /images or images.

For example, if you have the following directory structure:

root
-/include/
--/images/
--/css/

Where the "include" folder is a main folder, and images and css are within that include folder.

A file in the "css" folder would have to reference the images folder by:

background: url("../images/background.gif")well i was taught a few years ago to aviod .. backslashing through a web site. I was taught to start w/ a / which indicated that this is a directory off the root. Which this has held true for the last couple of years in asp. I have never had problems.
Example /Images/background.gif was the same as <!-- w --><a class="postlink" href="http://www.somewhere.com/Images/background.gif">www.somewhere.com/Images/background.gif</a><!-- w -->

But w/ asp.net it seems to not be the same. This could also be an issue w/ me developing on the local server where as w/ asp i develop from my client connected to the project located on the server, actually that might be the problem.

I also now that asp.net has the ~ which takes you back to the root.

Ok ill play w/ it tonight and see what i cant come up w/.
 
Back
Top