代码如下
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_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>无标题页</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Image ID="logo" runat="server" ImageUrl="~/App_Data/images/1.jpg" />
        </div>
    </form>
</body>
</html>
为什么设计时图片可以正常显示,编译运行就不行呢?

解决方案 »

  1.   

    图片路径不对吧,你看运行时点图片右键,看路径对不对,改下就行了 ImageUrl="../App_Data/images/1.jpg" 
      

  2.   

    不能放在App_Data目录下,App_Data是类目录,编译后的dll放在Bin
    因为编辑后App_Data是没有的
    自已建个文件夹存放
      

  3.   

    楼主试试这个··· 还有那个新建的图片文件夹名称最好设为Images Img 之类的便于管理