Images that are in App_Data folder not shown in browser

Muhammad Akhtar picture Muhammad Akhtar · Oct 5, 2009 · Viewed 27.5k times · Source

When I set image URL property to asp image control that is in App_Data folder, image is showing in page design view but not in browser.

<form id="form1" runat="server">
<div>
    <asp:Image ID="Image1" runat="server" ImageUrl="~/App_Data/p3.jpg" />
</div>
</form>

It seems to be straightforward, but it's not showing the image.

Answer

marc_s picture marc_s · Oct 5, 2009

The App_Data folder is a special folder reserved for data such as database files and so on, and will NOT render out any contents on the web. This is by design, and intentional and cannot be changed (as far as I know).

Your images do definitely not belong into the App_Data subfolder - put them into a /images folder or something more appropriate.