images not found

  • Thread starter Thread starter tshad
  • Start date Start date
T

tshad

I am using VS 2008 and in my aspx page my images are showing with squigly
lines (technical term) and saying that image not found.

But when it runs it finds them fine. The images are defined:

<asp:ImageButton ID="UpQuestion" visible="true" runat="server"
ImageUrl="~/images/arrowUp.gif" style="height:16px;width:16px;
vertical-align:middle" CommandName="Up" OnClick="moveQuestionRowUp"
AlternateText="^"/>&nbsp;

<asp:ImageButton ID="DownQuestion" visible="true" runat="server"
ImageUrl="~/images/arrowDown.gif" style="height:16px;width:16px;
vertical-align:middle" CommandName="Down" OnClick="moveQuestionRowDown"
AlternateText="v"/>

Why is that?

Also, if I have the path as the following, it still says not found and in
this case doesn't display:

ImageUrl="/images/arrowDown.gif"

I thought that the "/" said you start at the root and images is in the root,
so why doesn't it work here.

Also, if I have the path as the following, it still says not found and in
this case does display:

ImageUrl="images/arrowDown.gif"

The page is in the root so I would expect it to display. But in all cases,
it says images not found - when in fact they are there.

Thanks,

Tom
 
After serious thinking tshad wrote :
ImageUrl="/images/arrowDown.gif"

This searches for that image in the root of the site, so for instance
http://www.company.com/images/arrowDown.gif.

Your development system usually uses (virtual) subdirectories, so the
root of your site would be something like http://localhost/AppRoot/.
That image is requested as http://localhost/images/arrowDown.gif, which
probably is wrong.

You could use
ImageUrl = "~/images/arrowDown.gif";
to make sure that image is alwas requested from the root of your
*application* (instead of the *server*).

But even then: usually I (as developer) know the URL will be valid when
the complete page is shown in the browser, but VS can't figure this
out. So you can then ignore that "squiggly line".


Hans Kesting
 
tshad said:
I am using VS 2008 and in my aspx page my images are showing with
squigly lines (technical term) and saying that image not found.

What happens if you include them in the solution in the solution explorer?

N.b. If you add several thousand images, it might take several hours to
include them, during which time VS appears to be hung.

Andrew
 
Hans Kesting said:
After serious thinking tshad wrote :

This searches for that image in the root of the site, so for instance
http://www.company.com/images/arrowDown.gif.

Your development system usually uses (virtual) subdirectories, so the root
of your site would be something like http://localhost/AppRoot/. That image
is requested as http://localhost/images/arrowDown.gif, which probably is
wrong.

You could use
ImageUrl = "~/images/arrowDown.gif";
to make sure that image is alwas requested from the root of your
*application* (instead of the *server*).
I agree and that was how it actually is.
But even then: usually I (as developer) know the URL will be valid when
the complete page is shown in the browser, but VS can't figure this out.
So you can then ignore that "squiggly line".
So it is a bug in VS. It should know where it is. It created the project
so it knows were the root is

And this doesn't explain "images/arrowDown.gif", it was showing is not there
which is absolutely wrong. It is supposed to start from where the page is
(and I am not using a user control here) which is in the root already as is
the images folder (which is why it works on the web page). This doesn't
even involve looking for the starting point of the path - the starting point
is where you are at.

So why does VS say it can't find it?

Thanks,

Tom
 
Andrew Morton said:
What happens if you include them in the solution in the solution explorer?

N.b. If you add several thousand images, it might take several hours to
include them, during which time VS appears to be hung.
Not sure.

I will have to check when I get home. I'll let you know.

Thanks,

Tom
 
tshad said:
Not sure.

I will have to check when I get home. I'll let you know.

Just checked and I don't have include them in the folder. I noticed they
weren't showing in the images folder. When I right-clicked the folder and
hit refresh - they all showed up and the squigly lines disappeared from my
aspx page.

Thanks,

Tom
 
Back
Top