为什么imageurl在asp.net中不接受绝对路径? [英] Why imageurl does not accept the absolute path in asp.net?

查看:233
本文介绍了为什么imageurl在asp.net中不接受绝对路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<pre lang="xml"><%@ Page Language="C#" AutoEventWireup="true" CodeFile="Expt_Image2.aspx.cs" Inherits="Expt_Image2" %>
<!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>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

        <asp:Image ID="Image1" runat="server" ImageUrl="~/Image/Bluehills.jpg" Height="100" Width="100"/>
           <asp:Image ID="Image2" runat="server" ImageUrl="C:\Documents and Settings\Lovey\My Documents\Visual Studio 2008\WebSites\Expt-New\Image\Sunset.jpg" Height="100" Width="100"/>
    </div>
    </form>
</body>
</html>





在第一张图片中显示的不是第二张图片吗?





In this first image is displayed not second why?

推荐答案

因为您的第二条路径是本地文件路径而不是Url.您应该真正使用Urls.
Because your second path is a local file path and not a Url. You should really use Urls.


这篇关于为什么imageurl在asp.net中不接受绝对路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆