tags:

views:

107

answers:

2

The TempImage is located under the root directory of the current web app. When I try to set the ImageUrl of an image I get the error below. For some reason asp.net web server trying to locate the directory under its own current root

This is what I am trying to do:

<asp:image ImageUrl="~/TempImages/... />

Ive also tried

<asp:image ImageUrl="/TempImages/... />
<asp:image ImageUrl="./TempImages/... />
<asp:image ImageUrl="TempImages/... />

Returns this error:

Could not find a part of the path 'C:\Program Files\Common Files\Microsoft Shared\DevServer\9.0\TempImage

+1  A: 

If the image is in the root of the current application just specify:

<asp:image ImageUrl="~/imagename.jpg" runat="server" />
Chris Ballance
Thats exactly what I am doing and I get the error Could not find a part of the path 'C:\Program Files\Common Files\Microsoft Shared\DevServer\9.0\TempImage\image.jpg
theKing
are you using cassini (mini IIS for visual studio) or do you have this setup in IIS?
Chris Ballance
Why the Downvote?
Chris Ballance
A: 

Check if the asp.net user account has permissions to the directory. The cause can be that due to lack of permissions, other paths are being tried.

Hugo Zapata