We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


ASP.NET Graphics

SETP asked
Medium Priority
Last Modified: 2011-10-03
In Visual Studio Developer 2005 I create a new ASP.NET website. I add a GIF file to the App_Data directory. I drag and drop this GIF file to the Default.aspx file. An <IMG> object is created with the follwing scr property: App_Data/images/Logo.JPG

The HTML code for it looks like this:

<img src="App_Data/images/Logo.JPG" />

I now press F5 to run the site. Internet Explorer 6 launches and loads the page. However, instead of the image, I see a small placeholder for it (the standard IE placeholder when it can't find an image). Why is this?
Watch Question

well step you have to refresh the folder

go to App_Data  and right click on it and press the refresh folder option

and see if you get image

at first even i was frusted by this behaviour but later got used to it

good luck



Yes, I did refresh the App_Data folder in the Solution Explorer and the image did appear - that's how I was able to drag-and-drop it onto the form. And I can see it on the aspx page in design time perfectly. But as soon as I run the page (using either ASP.NET Development Server or IIS) it doesn't display the images.

Right click on the folder you want the picture in, in solution explorer
select add existing item
browse to your piccy and click ok
drag and drop and asp image control onto your page

<asp:Image ID="imgExample" runat="server" ImageUrl="~/Example/Example.gif" />

click on it in design view and find the Image URL property in the properties toolbox

click once inside that box

then click he button that appears with ... on it

navigate to the folder you added the image to

click ok or something

hope this helps


Thanks for the reply ptleitch.

Firstly, if I drag and drop the image from the Solution Explorer onto the form, it creates an HTML img object - not the Image Web Server control. But I did try dragging an Image Web Server control onto the form like you mentioned and following the steps you laid out. Unfortunately, it only displays the pic in design time - not at run time.

Does it work on your computer?

yes it works on my computer.  i could probably help you out if i was sitting right there but oh well.  

by not at run time, do you mean on your local machine?


yes, on my machine. I haven't yet uploaded it to the web server. I'm doing all the testing on my local machine.

paste some of your code, displaying images is a pretty straight forward task, and if it doesn't work, there might be something else wrong, have you gotten any images to show  up at all?
maybe do a build and then run the site

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


Do you think it might be a setting in IIS? Although I doubt it cause when I use the ASP.NET Development Server to run it (instead of IIS) it has the same problem.

I tried hard coding the path, as in:

<img src="D:\My Documents\Visual Studio 2005\Web SItes\Info1\App_Data\images\Logo.JPG" />

and then it works (i.e. it displays the image when I run the web site). But this is not an elegant solution, and won't work when I deploy the website.

I've also tried putting a tilde at the beginning of the path, as in

<img src="~App_Data/images/Logo.JPG" />

But it didn't work.


I trtied building the web site - unfortunately it didn't work. I haven;t gotten any images to show unless i hard code the full path. Here is what my .aspx page looks like:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
    <form id="form1" runat="server">
        <img src="App_Data/Logo.JPG" /></div>


I think Appdata is special folder in asp.net 2.0
Which allows you to store only xml ,database , text and report files

Try to create new folder name It Images  and place the image which is in appdata  folder now
Drag and drop the image from images folder in design time and
Run the page

Good luck
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.