使用C#在asp.net中使用图像控件在运行时显示图像时发现问题 [英] finding problems in displaying image at runtime with image control in asp.net with c#

查看:87
本文介绍了使用C#在asp.net中使用图像控件在运行时显示图像时发现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我是iam yogesh我是该社区的新成员...使用asp.net的iam.当我设置html图像控件的imageurl时,图像在设计时显示.但是当我运行该项目时,页面显示没有图像的图像控件,并且在左上角有一个小的图像图标.
我的代码在这里.但是我认为这是一个不同的问题.
请尽快给我回复朋友....

hi iam yogesh iam new to this communit... iam using asp.net . when i set the imageurl of html image control, the image is displayed at design time. but when i run the project the page shows the image control without image, and a small imamge icon on the upper left corner.
my code is here.. iam not new to asp. but i think its some different problem..
pls reply me soon friends....

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="imageview.aspx.cs" Inherits="ADVANCED_FORUM.imageview" %>
<!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>
        <img id="image1"  runat="server" alt="not avail." style="z-index: 100; left: 18px; position: absolute; top: 15px; height: 81px;" src="c:\photos\a1.jpg"/>
    </div>
    </form>
</body>
</html>

推荐答案

您的网站可能没有权限从C根目录查看photos文件夹.因此,将所需的图像复制到您的网站并使用相对路径(〜)来显示图像.即
Your web site may not have permission to view photos folder from C root directory. So copy the desired image to your website and use relative path(~) to display the image. i.e
<div>
        <img id="image1"  runat="server" alt="not avail." style="z-index: 100; left: 18px; position: absolute; top: 15px; height: 81px;" src="~/photos/a1.jpg"/>
    </div>


这篇关于使用C#在asp.net中使用图像控件在运行时显示图像时发现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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