ASP.NET - Image Does Not Display

I posted the image on the main page.

I see the image during development.

But I do not see the image at runtime.

What could be the problem?

I tried to put the image in the image window. But that didn't work either.

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="MasterPage.master.cs" Inherits="Ice_Web_Portal.UI.MasterPage" EnableTheming="true" %>

<!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>.::ICE Web Portal::.</title>
    <link href="App_Themes/SmokeAndGlass/SmokeAndGlass.css" rel="stylesheet" type="text/css" />
</head>
<body >
    <form id="form1" runat="server">
        <table style="position: static">
            <tr>
                <td align="left" colspan="2">
                    <asp:Image ID="Image1" runat="server" ImageUrl="~/App_Themes/Banner.JPG" /></td>
                <td>
                </td>
            </tr>
            <tr>
                <td rowspan="2">
                    <div>
                    &nbsp;</div>
                    &nbsp;</td>
                <td style="width: 3px">
                    <asp:LoginView ID="LoginView1" runat="server">
                        <LoggedInTemplate>
                            <table style="width: 204px">
                                <tr>
                                    <td>
                                        Login Status :</td>
                                    <td>
                    <asp:LoginStatus ID="LoginStatus1" runat="server" />
                                    </td>
                                    <td>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Login Name :</td>
                                    <td>
                    <asp:LoginName ID="LoginName1" runat="server" />
                                    </td>
                                    <td>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                    </td>
                                    <td>
                                    </td>
                                    <td>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                    </td>
                                    <td>
                                    </td>
                                    <td>
                                    </td>
                                </tr>
                            </table>
                        </LoggedInTemplate>
                    </asp:LoginView>
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td style="width: 3px">
                    <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
                    </asp:ContentPlaceHolder>
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;</td>
                <td style="width: 3px">
                </td>
                <td>
                </td>
            </tr>
        </table>
    </form>
</body>
</html>
+5
source share
10 answers

It looks like you might have a problem matching URLs ... For the ImageURL property, try setting it to "~ / Images / MyImage.png" ...

Instead of storing the image directly in the App_Theme folder, create a folder for the images and try using it instead. App_Theme directory is handled differently ...

+8

. - tilda (~), , .

, .

-? (, ?)
?

+2

, .

web.config, .

<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</configuration>
+2

, :

<link href="~/App_Themes/SmokeAndGlass/SmokeAndGlass.css" rel="stylesheet" type="text/css" runat="server"/>
+1

... , . HTML,

<img src="<sourceToImage>/App_Themes/Banner.JPG"/>

.. , .

"JPG" UPPER-case ( , ).

, .

0

Simple.

  • Images Project.
  • , . logo.jpg, Images
  • , , .. ImageURL, ~\Images\hlogo.jpg.

-.

0

, , , -, , img, .

0

IIS 7 ASP.NET . , Windows.

IIS -, Http " ".

css, images, html .

0

, , , , :

web.config ,

    <location path="Image Path">
    <system.web>
    <authorization>
    <allow user="*"/>
    </authorization>
    </system.web>
    </location>

,

0

I had a similar problem with my VB.NET application using IIS 8.5 on 2012 R2. I must specifically add my image extensions (.jpg, .png) to the "Filter request" for my default site in IIS 8.5.

0
source

All Articles