Image server control - where am I going wrong?

J

John Austin

I thought I would experiment for the first time with an Image standard
control in VS 2005. I pressed create web site, I copied a jpg into the
App_Data folder, added an image control to Default.aspx and set the ImageUrl
to the jpg ( ~/App_Data/Picture.jpg ). The picture appears in the designer,
but when I run the page there is no picture.

What am I doing wrong - I have no idea!
 
B

Bob Barrows [MVP]

John said:
I thought I would experiment for the first time with an Image standard
control in VS 2005. I pressed create web site, I copied a jpg into the
App_Data folder, added an image control to Default.aspx and set the
ImageUrl to the jpg ( ~/App_Data/Picture.jpg ). The picture appears
in the designer, but when I run the page there is no picture.
There was no way for you to know it (except maybe by browsing through some
of the previous questions before posting yours - always a recommended
practice) , but this is a classic asp newsgroup. ASP.Net bears very little
resemblance to classic ASP so,
while you may be lucky enough to find a dotnet-knowledgeable person here who
can answer your question, you can eliminate the luck factor by posting your
question to a group where those dotnet-knowledgeable people hang out. I
suggest microsoft.public.dotnet.framework.aspnet.


Don't use the App_Data folder. Create a folder called images and put the
image file in that folder.
From http://msdn2.microsoft.com/en-us/library/445z2s49.aspx:
When you create a Web site in Visual Web Developer, Visual Web Developer
creates a folder named App_Data below the current root folder. The folder is
designed to be a store for application data, including Access databases. The
App_Data folder is also used by ASP.NET to store databases that the system
maintains, such as the database for membership and roles. When Visual Web
Developer creates the App_Data folder, it grants Read and Write permissions
for the folder to the ASPNET or NETWORK SERVICE user account.

Note
As a security measure, files in the App_data folder are not served by
the Web server. Do not store any Web pages in the App_Data folder, because
users will see an error if they request a page from that folder.
 
W

Walter Wang [MSFT]

Thanks Bob for your excellent and professional answer.

Hi John,

Thank you for using MSDN Managed Newsgroup Service!

The reason why we recommend posting appropriately is you will get the most
qualified pool of respondents, and other partners who the newsgroups
regularly can either share their knowledge or learn from your interaction
with us. Thank you for your understanding.

Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top