Unable to Display Image in ASP.NET Using C#

I am attempting to display an image on my header of a ASP.NET web page I am creating, and I am only getting a box with an "x" in it representing the location where the picture is supposed to appear. I have checked to make sure that the picture is in the same directory as the main project files, and they are present. I have also made sure that the Default.ASPX page does contain a valid reference to the location of the image attempting to be used, and I receive the attached results. Could someone help me figure out what I am doing wrong with regards to syntax in ASP.NET? Any and all help would be greatly appreciated.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="FuelReceiptsResearch._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Fuel Receipt Research</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table>
            <tr>
                <td colspan="2"><img src="ta_header.jpg" alt = 
                        style="width: 133px; margin-bottom: 18px"  /></td>
            </tr>        
        </table>
        <asp:Image ID="Image1" src = "ta_header.jpg" runat="server" Width="110px" />
    
    </div>
    </form>
</body>
</html>

Open in new window

Results of Web Page Source Code Directory With Image
thenthorn1010Asked:
Who is Participating?
 
thenthorn1010Connect With a Mentor Author Commented:
The issue was resolved by adding the items indvidually to the Visual Studio project and recreating all directories within VS 2008 Team and moving all of the images being used into the corresponding directory. it seemed as though Windows XP and VS 2008 would not recognize the directory where the image was located and it took several attempts of removing the image from the project and just adding the image again in order to have this issue resolved. This issue seems like a bug within MS Visual Studio 2008 and Windows XP.
0
 
plusone3055Commented:
stop your Service and restart it :)

its always common practice in ASP App to make a Images Folder
and drag the image from the folder onto your code creating a perfect link :)
0
 
thenthorn1010Author Commented:
plusone3055,

Thank you for the advice...I did start and stop the service that was running, and I am still ending up with a box with a red "X" in it on the upper hand corner of the screen. (In my run-time environment, I see the image that should be displayed without any issue, after taking your suggestion of dragging the image from the source folder to get a "perfect link.")

Is there anything else that I am missing that is causing this issue when I run the ASP site in debug mode?

Thanks
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="FuelReceiptsResearch._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Fuel Receipt Research</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table>
                <tr>
                <td colspan="2"><img alt="" src="../ta_header.jpg" /></td></tr>
        </table>
    
    </div>
    </form>

</body>
</html>

Open in new window

Updated Web Site Results Run Time View of VS 2008 Environment
0
 
thenthorn1010Author Commented:
Resolved issue on my own by just playing with Visual Studio 2008 and Windows XP until the development studio recognized the directory that I was using and the image that was being used. None of the code changed from the code that was originally posted to this question in making the image appear. It just seems as though there was an issue inside of VS 2008 and Windows XP not picking up a directory with the specified image that was to be used.
0
All Courses

From novice to tech pro — start learning today.