Locating a Picture file

Discussion in 'Visual Studio' started by luke_jack61188, Jun 30, 2006.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Hello,

    I'm using a master page with a background image for all pages within my website. The code I'm using to display the background is as follows:







    This works fine for any page that is not stored in a subfolder (e.g. it works fine for default.aspx), however, it doesn't work for a page such as one located at /plantsearch/textsearch.aspx, which is located in a subfolder (the browser tries to look for the image at /plantsearch/images...). I've tried playing around with the "/" and "~" at the start of the code show above but without success. I realise I couldjust usethe whole URLto identify the background image is located but surely there is an easier way?





    Many thanks,


    Luke
     
  2. The ~ is only understood by server side controls. The HTML code you have pasted below is rendered to the client, therefore the ~ is not understood.

    Your path should start with /


    Joel Thoms
    DiscountASP.NET
    http://www.DiscountASP.NET
     
  3. Joel is definitely right here.

    Remember that starting a URL with a / means you are referencing the root directory regardless of what directory you are currently located in. So your paths will look something like '/images/picture.jpg' even if you are in some other folder.
     
  4. Or you can use relative path like ".../images/welcome.gif"

    J. Bey
    Free-lancer IT Pro.
    "Life is tough...but programming is FuN"</CODE>
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page