[Resolved] [2008] ImageButton not displaying Image
Hello,
I have an ImageButton, which looks fine in the design mode, but when I run the application the image appears as a red 'x'.
<asp:ImageButton ID="imgExport" runat="server"
ImageUrl="~/App_Data/excel_icon.jpg" />
I think that the code looks OK and the permissions of the App_Data folder look fine, but I am at a loss of what to check next.
I'm sure its a newbie error, but I have potterd around for a while without finding the solution, I would welcome any help.
Re: [2008] ImageButton not displaying Image
Hi!
Have you checked the image url at runtime to see where it points? Then try and display this image by typing that url in the browser.
Also, try to create an "Images" folder in the webproject root and put your pictures there. There is no particular reason to put the images in App_Data. A better place would be the resx files if you want more control.
/Henrik
Re: [2008] ImageButton not displaying Image
hi, thanks for the reply
I have put the pic in a pictures folder and get the following when look at the ImageURL at run time
~/App_Data/pictures/excel_icon.jpg
When I try to access it (I assume that this would be the correct path) using
http://localhost:63546/WebSite2/App_...excel_icon.jpg
I get
Server Error in '/WebSite2' Application.
--------------------------------------------------------------------------------
HTTP Error 403 - Forbidden.
--------------------------------------------------------------------------------
Version Information: ASP.NET Development Server 9.0.0.0
Re: [2008] ImageButton not displaying Image
Never place images in the App_Data folder. It is a special folder meant only for database related files. You need to move your images.
Also, note that images are not actually data, so logically they shouldn't be in the App_Data folder anyways.
Re: [2008] ImageButton not displaying Image
Well, I moved it to a seperate folder outside of the app_data folder and .... hey presto it worked!
So, thankyou :)
:afrog:
Re: [Resolved] [2008] ImageButton not displaying Image