Images showing at design time but not runtime

Last post 07-03-2008 3:59 PM by vinz. 6 replies.

Sort Posts:

  • Images showing at design time but not runtime

    07-03-2008, 12:53 AM

    Hey all,

    I'm using Visual Web Developer 2008 and I have somewhat of a problem.  As the message header stated, I can see the images just fine at design time but when I run the site (local host), the image won't show.  I have tried all the usual tricks, ~/,  ../,  MapPath and nothing will work!  I have tried setting the image url with the properties editor and it generates the ~/ code which is not working.  Does anyone have an idea of what to do? 

  • Re: Images showing at design time but not runtime

    07-03-2008, 1:51 AM
    • Participant
      1,278 point Participant
    • niharnayak2003
    • Member since 11-22-2007, 4:59 AM
    • Chennai
    • Posts 243

    This path shoud work

     You can set a relative path like this: "~/images/yourimage.gif"

    But can you give your folder structure of the images and where is your aspx page both the structure. so that i can say what can be done.

    Nihar ranjan Nayak
    Microsoft certified Professional
    niharnmayak2003@yahoo.co.uk
    www.webnihar.com
  • Re: Images showing at design time but not runtime

    07-03-2008, 10:32 AM

    Thanks for the reply!

    My images are stored under the App_Data folder and my aspz pages are stored in the standard directory.  As a note, I have tried using an image that's stored the same directory as the aspx page but it still doesn't work.  Do you know if there is some Visual Studio setting that needs changed?

  • Re: Images showing at design time but not runtime

    07-03-2008, 10:51 AM
    Answer
    • All-Star
      91,550 point All-Star
    • vinz
    • Member since 10-05-2007, 11:47 AM
    • Cebu, Philippines
    • Posts 13,758
    • TrustedFriends-MVPs

    That's because you're putting the Images in the Wrong Folder.. App_Data  is where DB, XML files are placed and not images.. so i would suggest you to create a separate Folder that will contain your images.. see below

    Solution
    C://Project Destination
    App_code
    App_data
    App_themes <-- You can put the images here for you to get referenced with
    Images <--or Put the images here for you to get referenced with
    Defuault.aspx
    Web.Config

    "Code,Beer and Music ~ my way of being a programmer"

  • Re: Images showing at design time but not runtime

    07-03-2008, 3:17 PM

    Thanks man! You had the winning answer.  I still don't understand why Asp.Net can't map to the App_Data folder for images.  I've created a folder called: "images" and everything is smooth sailing for right now.

     

    Thanks again,
    Richard

  • Re: Images showing at design time but not runtime

    07-03-2008, 3:37 PM
    • Participant
      1,278 point Participant
    • niharnayak2003
    • Member since 11-22-2007, 4:59 AM
    • Chennai
    • Posts 243

    If your Image and ASPX page are in a single directory then use

    <image src="imagename.gif"/>

    dont use any thing just the image name.

    let me know

    Nihar ranjan Nayak
    Microsoft certified Professional
    niharnmayak2003@yahoo.co.uk
    www.webnihar.com
  • Re: Images showing at design time but not runtime

    07-03-2008, 3:59 PM
    Answer
    • All-Star
      91,550 point All-Star
    • vinz
    • Member since 10-05-2007, 11:47 AM
    • Cebu, Philippines
    • Posts 13,758
    • TrustedFriends-MVPs

    richerTextBox :

    I still don't understand why Asp.Net can't map to the App_Data folder for images.

    refer to the following link below for you to find out.

    http://benfulton.net/blog/2005/11/no-images-allowed-in-appdata-folder.html 

    "Code,Beer and Music ~ my way of being a programmer"

Page 1 of 1 (7 items)
Microsoft Communities