代码如下
<%@ 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>
为什么设计时图片可以正常显示,编译运行就不行呢?
<%@ 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>
为什么设计时图片可以正常显示,编译运行就不行呢?
因为编辑后App_Data是没有的
自已建个文件夹存放